Archived

This topic is now archived and is closed to further replies.

xropi

release vs debug version

Recommended Posts

My MSVC6.0 doesn't seem to generate equivalent codes for debug and release versions of the same project. I have a bug, but I cannot debug it because debug version won't fail while release crashes in the same situation. Is there any compiler option that makes them equivalent? Is this compiler behavior valid? (I don't think so) Ropi [edited by - xropi on November 11, 2002 1:02:02 AM]

Share this post


Link to post
Share on other sites
disable optimizations and enable debug info for release config.

and don''t blame your bugs on compiler until you are absolutely sure that the compiler is responsible for failing code.

Share this post


Link to post
Share on other sites
Most of the times when I''ve had this happen, it''s because of an unititialized variable somewhere. Debug versions have their data initialized to a specific value, and Release versions can be any random value. Try looking for that kind of bug first.

Mark Fassett
Laughing Dragon Entertainment
http://www.laughing-dragon.com

Share this post


Link to post
Share on other sites
quote:
Original post by LaughingD
Most of the times when I''ve had this happen, it''s because of an unititialized variable somewhere. Debug versions have their data initialized to a specific value, and Release versions can be any random value. Try looking for that kind of bug first.

Mark Fassett
Laughing Dragon Entertainment
http://www.laughing-dragon.com



I thought that that''s in the background.

Can I force the compiler to remove those initializations in the debug version?

Share this post


Link to post
Share on other sites
Take the suggestion from LaughingD. I have personally spent too much time looking for a bug when I finally realized that I had stray pointers EVERYWHERE! =(
always set all pointers to NULL or something.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The uninitialized variables problem is the most common. Another common one for people is to put function calls inside ASSERT calls. Like..

ASSERT( DoSomethingImportant() );

ASSERT dosn''t get compiled in Release build so neither does the DoSomethingImportant() function call.

Share this post


Link to post
Share on other sites
quote:
Original post by xropi
My MSVC6.0 doesn''t seem to generate equivalent codes for debug and release versions of the same project.

That''s the point of having separate build options.
quote:

I have a bug, but I cannot debug it because debug version won''t fail while release crashes in the same situation.

That almost certainly means you are invoking undefined behaviour somewhere, by overrunning an array, accessing memory you don''t own, dereferencing an invalid pointer, or something like that. Debug builds tend to overallocate memory, so are more forgiving on such behaviour.
quote:

Is this compiler behavior valid? (I don''t think so)

Yes, it''s valid.

Share this post


Link to post
Share on other sites