The essential difference between the Debug and Release compilation methods in VS

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.