简体   繁体   中英

Visual Studio Compiler Default for /O

Does VS2010/12's compiler use a default optimization level when none of /Od,/O1,/O2,/Ox is provided in a C++ compilation command line?

I'm currently using /Od since I witnessed some optimization related bugs when using the other levels. However, this leads to /GS being disabled - which is unwanted.

When I clear the box for the "Project Properties->C/C++->Optimization->Optimization" option, I see the command line indeed doesn't contain any option. But I don't know if this just means the compiler uses some default optimization level.

No optimization seems to be the default - see output from "cl /?" below:

                          -OPTIMIZATION-

  /O1 minimize space                      /O2 maximize speed
  /Ob<n> inline expansion (default n=0)   /Od disable optimizations (default)
  /Og enable global optimization          /Oi[-] enable intrinsic functions
  /Os favor code space                    /Ot favor code speed
  /Ox maximum optimizations               /Oy[-] enable frame pointer omission

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM