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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
yodanConnect With a Mentor Commented:
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
 
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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
 
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
 
nietodCommented:
sumsumsum, are you out there?  
0
 
abdijCommented:
Hi Man,

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

Bye
Abdij
0
All Courses

From novice to tech pro — start learning today.