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)
Debug version:
/MDD/MLD or/MTD using the Debug Runtime Library (debug version of runtime function library)
/od off optimization switch/d "_DEBUG" equivalent to #define _DEBUG, open compile debug code switch (primarily for assert function)/zi create Edit and Continue (edit continue) database , so that if you modify the source code during debugging, you do not need to recompile/gz to help capture memory errors/gm
Reduce link time by turning on the Minimize heavy link switch
Release version:/MD/ML or/MT Use the release version of the runtime function library/o1 or/o2 optimization switch to make the program minimum or fastest/"ndebug" Off the conditional compilation debug code switch (that is, do not compile the ert function)/GF Merge duplicate strings and put string constants into read-only memory, anti-modification in fact, Debug and Release have no intrinsic boundaries, they are just a set of compilation options, and the compiler simply acts on 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.
The essential difference between Debug and Release compilation methods