Reputation: 20274
What are the cons of debugging a native C++ program using Visual Studio in the release mode? Why should I bother myself by setting up two differents modes instead of just simply debug in the release mode?
By debugging in release mode, I mean after setting all needed configuration (generate debug info, disabling optimization and incremental linking...)
In other words, why should I have a debug mode where I have to link my project to a debug version of any third party while I can simply change my release mode to a "debuggable version of release mode" (supposing I do not want to dig into the third library while debugging my application)
Upvotes: 1
Views: 339
Reputation: 179917
You're missing the debug runtime library! This will check for incorrect arguments to the runtime, a type of error which may lead to unexplainable crashes in the release runtime.
Upvotes: 1
Reputation: 62005
If you a) generate debug info and b) disable optimizations, then this is hardly release mode. It is debug mode without _DEBUG enabled.
Some people define such a third build configuration on top of pure-debug and release-only precisely for debugging issues that sometimes popup on release-only.
Alas, the types of problems that pop up on release-only builds tend to be caused by optimizations, so this kind of build is of limited use. But if it suits you, nothing prevents you from using it.
It is just that _DEBUG is supposed to cause additional information to be emitted in the log, and of course assertions to be checked, both of which are under normal circumstances indispensable for developing. So, think of "debug" mode not strictly as "debug", but actually as "development" mode.
The purpose of having different builds is so that you don't have to mess with their configurations all the time. You just configure the builds you want, and then you forget about them. If you modify your release build for debugging purposes, then next time you want to send a new release to the great outdoors, you will have to undo these modifications and rebuild a new "real" release mode build. You don't want to have to be doing that.
Also, the _DEBUG mode of a third-party library may generate logging which might be useful to you for debugging, but most importantly, it will probably also perform additional input parameter checking, which is absolutely indispensable for developing robust software. So, you do not want to be developing on a third-party library which is not in _DEBUG mode.
Upvotes: 7