The essential difference between the Debug and Release compilation methods in VS
Debug is often called a debug version, it contains debugging information, and does not make any optimizations to facilitate the programmer to debug the program. Release, known as the release version, is often optimized to make the program optimal in terms of code size and speed, so users can use it well.
the real secret of Debug and Release lies in a set of compilation options. The options for both are listed below (of course, there are others, such as/FD/FO, but the difference is not important and usually they do not cause the release version error, not discussed here)
The following parameters are in the Project–>settings–>c/c++–>project Options:
Debug version
Parameter meaning
/MDD/MLD or/MTD using the Debug Runtime Library (debug version of runtime function library)
/od Turn off the optimization switch
/d "_DEBUG" equivalent to #define _DEBUG, open the Compile debug code switch (mainly for the Assert function)
/ZI Create the Edit and continue database so that if the source code is modified during debugging, it does not need to be recompiled
/GZ can help capture memory errors
/gm to reduce link time by turning on the Minimize heavy link switch
Release version
Parameter meaning
/MD/ML or/MT using a published version of the runtime function library
/O1 or/o2 optimized switch for minimum or fastest program
/d "Ndebug" Turn off conditional compilation debug code switch (that is, do not compile the Assert function)
/GF merges duplicate strings and puts string constants into read-only memory to prevent modification
In fact, Debug and Release do not have an essential boundary, they are just a set of compilation options, and the compiler simply acts according to the intended options. In fact, we can even modify these options to get an optimized debug version or a release version with a trace statement.
Http://blog.joycode.com/roboo/archive/2004/08/09/30057.aspx
Http://blog.joycode.com/kaneboy/archive/2004/08/09/30041.aspx
Reference URL:
Http://blog.chinaunix.net/uid-10018502-id-2972023.html
The essential difference between the Debug and Release compilation methods in VS