Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have developped a complex algorithm years ago. It is even difficult for me to understand it's structure now after years. But I want to use it now as a part in a new project. While trying to integrate this code in the new project, I got a bizarre phenomenon.

If I compile the code by VC++6, the algorithm works correct, in debug and release version. If I use the expression "incorrect" in the following here now, it does not mean that the algorithm makes completely wrong results, but results that are much worser in quality as I would call it "correct".

If I compile the same code by Visual Studio C++ 2010, the algorithm works incorrect (= low quality results) in the Releaase version. Same effect (bad results) if I start the exe-File that was produced by Debug-Compile and Link. But if I start the program in the VS2010 IDE, from "Debug->Start without debugging = F5", it makes correct results (= good quality, same results as with Debug+Release in VC++6). How is this possible ? Certainly the IDE starts the Debug-exe-File in another way as if it is started manually from command prompt. What is the setting, to get these results also in the Release version ?

I have changed all Project-Settings now, so that they are similar: Release = Debug. Especially I have switched off all optimizations. But there is still the effect that I get the correct results only if I start the program by Debug->Start in the IDE.

So I can not understand this effect, I get crazy cause of that, because I have tried everything to match that during the last three nights, without success. I have also tried it with Visual Studio 2017, with the same result as in VC++ 2010.
I have also tried to link a lib-file with the old code, that was compiled and linked by VC++6, in the new project in VC++ 2010. But in effect also this produces incorrect results (bad quality results).

I need a Release version that is runable in Windows 10 with the correct (good) results. I can not get this with VC++6, so that I need a solution for this bizarre effect please.

What I have tried:

I have also tried to link a lib-file with the old code, that was compiled and linked by VC++6, in the new project in VC++ 2010. But in effect also this produces incorrect results (bad quality results).
Posted
Updated 18-May-18 13:58pm
Comments
phil.o 18-May-18 11:41am    
Hard to say :)
Perhaps try to deactivate eventual optimization features in release build, and see if that changes anything?

1 solution

Quote:
Different results in debug+release version of visual studio C++ 2010, although same project settings for release+debug

Do you know that 1 difference between debug and release versions is that in debug version, variables are initialized, which is not the case with release version.
Said otherwise, if you have an uninitialized integer variable, the debug version will initialize it to 0, in release version the initial value will be unpredictable, random.
But without seeing the code ...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900