简体   繁体   English

Visual Studio编译器默认为/ O.

[英]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? 当在C ++编译命令行中没有提供/ Od,/ O1,/ O2,/ Ox时,VS2010 / 12的编译器是否使用默认优化级别?

I'm currently using /Od since I witnessed some optimization related bugs when using the other levels. 我正在使用/ Od,因为我在使用其他级别时目睹了一些与优化相关的错误。 However, this leads to /GS being disabled - which is unwanted. 但是,这会导致/ GS被禁用 - 这是不需要的。

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. 当我清除“项目属性 - > C / C ++ - >优化 - >优化”选项框时,我看到命令行确实不包含任何选项。 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 /?" 没有优化似乎是默认值 - 请参阅“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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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