The “Optimize code” checkbox in Visual Studio. What exactly does it do?

后端 未结 3 1515
青春惊慌失措
青春惊慌失措 2021-02-07 03:27

The Build tab of the Project Properties in Visual Studio 2005/2008 contains the \"Optimize code\".

The documentation states that it \"... enables or disables optimizatio

3条回答
  •  清歌不尽
    2021-02-07 04:16

    Wikipedia has an article on compiler optimization that covers many of the basic types of optimizations.

    You don't want to create optimized debug builds. Optimization affects the debugabbility of your code - some lines of code may be removed, some lines of code from different parts of a function or from different functions may be merged together, local variables may be folded together, and so on. This means when debugging your current line can appear to jump around randomly due to the code being reorganized and inspecting local variables can be very misleading - the space for a local might be reused when it is no longer needed and appear to give a jibberish result.

提交回复
热议问题