Release Mode and Debug Mode

I am building a program with the MS Visual C++ 6.0. At the beginning, I build the project in the release mode it can compile without errors and works correctly. But when I change it into Debug mode the program also compile correctly but it prefoem illegal operations and  when I try to do the "Debug" the complier told me that it stop at some when in the dissambly program. What's wrong? How can I deal with it?
sumsumsumAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

freshmeatCommented:
interesting, i want to know the answer, too
0
nietodCommented:
a debug version often does many additional checks for errors that are not done in a release version.  These checks are to help the programmer detect problems in the code--that is why it is called a debug version.  Unfortunately, this makes the debug version run slower and take up more space than release version.  so when you have debuged the program, you should create a release version for the end user to use.

Other than that, I cannot tell you any more about what the problem is without more details from you.  Like where does the error occur? what file? what line?  Have you included debug information in the debug version of the project?  Are you running the project under the VC debugger?
0
abdijCommented:
Hi,
 The Debug version initializes the uninitialized vars etc. It additionally checks for the memory leaks. SO if your program is not memory tight, that is there are memory leaks or pointer mismanagement (VC automatically puts 0xcdcdcd to invalid pointers) then ptr->Value gives assertions. So the Debug version problems has to be correctly resolved for a good app.

Hope others add to this info. I am sure its not complete.

Bye
Abdij
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

SteveGTRCommented:
You need to find the point in your code that initiated the exception in Windows.

I do this by opening up the Variable window (View -> Debug Window -> Variables) and pressing the Context combo box down arrow. Find a reference to your code.

To verify that this is the problem, set a break point where the reference is and rerun the program in debug mode. Press step over and see if the problem occurs. Next examine the parameters that you are passing to the function are they valid?

Good Luck,
Steve
0
abdijCommented:
Hi,
 If your app is in Debug Build, then when an exception occurs it automatically starts the VC++ (Visual Studio). There in the Context List you can know where exactly your code has failed.
Abdij
0
nietodCommented:
>> then when an exception occurs it
>> automatically starts the VC++ (Visual Studio)
Only if just-in-time debugging is installed and if VC is the default debugger.
0
yodanCommented:
If you have code inside
assert()
that is assertions, that is meaningful for the program execution then you may find yourself with the same problem.

If you have memory leaks you can compile your DEBUG version with debug info and still make steps, breakpoints, ...
to find where the program fails. And then activate the safest _CheckCrtMemory() mode that will catch the more writing errors possible.

If it helps you can compile the RELEASE version with debug info so that you may step and breakpoint and almost everything else that you do in DEBUG-version, except for the heap-memory-model.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nietodCommented:
sumsumsum, are you out there?  
0
abdijCommented:
Hi Man,

 Repeating Nietod . Are you there???????????????????????????????

Bye
Abdij
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.