Optimization switches and Visual Studio 2008
In a previous entry I noted that you generally do not need to micromanage your optimization switches.
However, in Visual Studio 2008 (both with and without SP1) there is a bug where the default optimization switch, /O2
, is not applied even when shown in the IDE under Configuration Properties->C/C++->Optimization
.
This happens when you select <inherit from parent or project defaults>
. Instead, you want to explicitly set Maximize Speed (/O2)
(it will show up in bold when explicitly set). You should also verify that the /O2
flag is being applied by viewing the command line (Configuration Properties->C/C++->Command Line
).
There is more about this bug on Microsoft Connect, where it's also noted that this bug will be fixed in Visual Studio 2010.