Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 01 Mar 2006
Offline Last Active Today, 12:38 AM

Posts I've Made

In Topic: Introducing Stanza: A New Optionally-Typed General Purpose Programming Langua...

20 May 2016 - 11:50 AM

That tab thing gives me an idea. If I ever make a language, you'll be forced to have whitespace around any binary operators. No more "a+b" in my language. The inherent productivity will be huge.

He just did that. a+b is a single identifier in Stanza. f(x) and f (x) are also different expressions.


I think this could lead to programmers hunting missing or extra spaces, but I could be wrong, and the language is protected from misspelling for an extent.

In Topic: Data alignment on ARM processors

28 April 2016 - 11:34 AM

On ARM processor the alignment of data is important. It can read/write much faster at aligned positions. So 2-byte long value should be on an even address, and a 4-byte long value should be on an address dividable by 4. There are codes for unaligned read/write but they are different, longer and slower. The compiler must find out which code has to be used, and generally it does a very good job finding it out, but a few times fails.


These failed cases always contain a reinterpret_cast. In your case this is the C-style (int*) casting. That kind of casting is typically used in loading/saving data, or receiving/sending data through network. In other places it is typically just bad design, and should be avoided.


So I recommend you to concentrate all your code that uses reinterpret_cast into one or few classes, and handle the problem there.


And you can create a function for this kind of reading/writing similar to your doLittleBigEndianConversion. Like this:

float value = doLittleBigEndianConversion(doUnalignedReading(reinterpret_cast<int*>(ucharPtr + offset));

In that function just use the memcpy trick or read the data byte by byte and assemble it with |.

In Topic: Simple code for reading and writing file in UTF-16 mode

14 April 2016 - 11:59 AM

On Windows (but preferably everywhere else too) always use binary mode file streams, because text mode file streams may replace end of line characters:

std::wofstream OutputFileStream(L"C:\\Users\\Administrator\\Desktop\\Test\\Output.txt", std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);

In Topic: Keyboard input Windows

07 April 2016 - 06:33 PM

No. There is no Win32 documentation stating such thing. If you're holding a key you'll just receive multiple WM_KEYDOWN events.

No. When you press a key, a WM_KEYDOWN is sent, and when you release the key, a WM_KEYUP is sent. The WM_KEYPRESSED message repeats during the hold, but it is less useful for game input.

In Topic: Effects11 DirectX11 for GCC Compiler

22 December 2015 - 06:53 PM

As far as I know, DirectX is not compileable anything else than MSVC. This is a kind of vendor lock-in. I'm not really up-to-date, but I think it's improbable that anything changed in this question.