Differences between the release and debug Versions in vc ++

Source: Internet
Author: User

Two versions of debug and release can be generated in the compiling environment of VC. The differences are as follows:

 

Debug is usually called a Debug version. It contains debugging information without any optimization, so that programmers can Debug programs easily. Release is called a Release version. It is often optimized to optimize the code size and running speed, so that users can use it well.

The real secret of Debug and Release lies in a set of compilation options. The options for the two are listed below (of course there are other options, such as/Fd/Fo, but the difference is not important. Usually they will not cause a Release version error)

Debug version

Parameter description
/MDd/MLd or/MTd use the Debug runtime library (the runtime function library of the Debug version)
/Od turn off the optimization Switch
/D "_ DEBUG" is equivalent to # define _ DEBUG. Enable the compile and DEBUG code switch (mainly for the assert function)
/ZI creates the Edit and continue database, so that the source code does not need to be re-compiled if the source code is modified during the debugging process.
/GZ helps capture Memory Errors
/Gm enables the minimize reconnection switch to reduce the link time

 

Release Version

Parameter description
/MD/ML or/MT use the runtime function library of the released version
/O1 or/O2 optimization switch to minimize or minimize the program
/D "NDEBUG" Disable the Conditional compilation and debugging code switch (that is, do not compile the assert function)
/GF combines repeated strings and puts string constants in read-only memory to prevent Modification

 

In fact, there is no essential limit between Debug and Release. They are just a set of compilation options, and the compiler only acts according to the predefined options. In fact, we can even modify these options to get optimized debugging versions or release versions with trace statements.

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.