I searched many questions which asked related information, but the answers didn't quiet match exactly what I wanted for an answer. I'll try to explain the issue as best I can.
Basically when running the code in release mode the compiler seems to remove most code that is redundant or dead code. So it ends up checking nothing. Some fixes were to make the code stored to some variable, but then the compile just removes the looping and stores that last increment it seems.
Now I do wish to have the optimizations made which improve the code used, but I still want everything it was originally doing E.g. If I made it loop the code 100,000 times I expect it to actually perform the code 100,000 times. I'm not sure how to modify the compiler on Visual Studio 2010 so that It does the minimal optimizations when compiling in release mode. I very much would like to accurately time something, but I'm not sure how to accurately time somthing.
At first I thought running in debug without debugging might fix the issue and it very much seemed to since the results matched that of a Java application, but when running in release mode the results where insanely faster which confuses me. I'm not sure if C++ is just that much better in the optimizations or if a large amount of code has been changed.
Is there any way to also dissemble the code possibly and view what the compile compiled the code into? This would be another test I'd like to see, but I don't know much about this stuff and anything in the right direction would be greatly appreciated. Alright well thanks to anyone who can somewhat understand what I'm asking for. I'll be glad to reply to any questions regarding any misunderstanding or uncertainty's on the question at hand.