Syndicate content

optimization

Compiling in 64bit with VC 2010 can result in a crashing software

Today, as I was trying to run a 64 bit application in Release mode under Windows 7, I got a crash about a NULL pointer. There is the debuggee (<- well known Microsoft spelling of Debugger) error window:

Unhandled exception in ... Access violation reading location 0x0000...

Unhandled exception at 0x52740ccf in guikeyboard_test_developer.exe:
0xC0000005: Access violation reading location 0x0000000000000000.

So... according to this error, the software access a NULL pointer. It took me some time, but the problem was not a NULL pointer, it was an unaligned memory access. In other words, it is trying to write a a pointer that is not 16 bytes aligned, which is ...

C++ automatic optimizations

Once in a while I check how the compilers are behaving in such and such situations to make sure that when I wrote code it gets properly optimized. Today I was surprised as I tried to put a break point of a variable and it looked like the compiler wasn't using it. Indeed, the optimizer 100% removed the variable from the final code. Quite interesting since trying to reverse engineer this assembly language would probably end up using a goto statement... (ouch!)

The code goes more or less like this:

[toc hidden:1]
Syndicate content Syndicate content

Diverse Realty

Diverse Realty Team

Want a New Home?
Want to Sell Your House?

Call Alex at
+1 (916)
220 6482

Alexis Wilke, Realtor
Salesperson
Lic. # 02024063

Cory Marcus, Broker
Lic. # 01079165

     

Terms of Site Index

Find the page/content you are looking for with our index.