Optimize at the Command Line

OverviewDetails

Feature Only in Professional and Enterprise Editions   Code optimization is supported only in Visual C++ Professional and Enterprise Editions. For more information, see .

The CL (Compile and Link) command has switches you can use to effect optimization. See Optimization Switches for a list and description of the switches.

Using the /O2 switch as an example, you might issue

cl /O2 source.c

to maximize your executable for speed.

There is an abbreviated syntax for using more than one switch. If you want to use /Og and /Os, for example, you could specify /Ogs.