次の方法で共有


Optimization Switches

How Do IDetails

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

Switch Description
/G5 Optimizes for Pentium processor.
/G6 Optimizes for Pentium Pro processor.
/GB Optimizes the code created to favor the Pentium. It blends the optimizations for the 80386 (/G3), 80486 (/G4), Pentium (/G5), and Pentium Pro (/G6) options.
/G3 Optimizes for 80386 processor.
/G4 Optimizes for 80486 processor.
/Gd Specifies function calling conventions; not commonly used.
/Ge Enables stack probes for every function call that requires storage for local variables; not commonly used.
/Gf Copies identical strings into one location in the executable file.
/GF Same as /Gf but copies strings into read-only memory; the strings cannot be modified.
/Gh Calls a function (that you will write) at the beginning of every function call in your program. This will make your executable file larger and slower: a debug tool.
/Gi Controls the incremental compiler, which compiles only the functions that have changed since the last compile. The compilation is speedier but the executable file is larger: a debug tool.
/Gm Speeds build if project has many files that have not changed since last compile.
/Gr Specifies function calling conventions; not commonly used.
/GR Adds code to check object type at runtime. The executable file will be larger.
/Gs Controls stack probes; not commonly used.
/GX Controls whether destructors are called for automatic objects during a stack unwind that is caused by either a Windows NT-based structured exception or a C++ exception.
/Gy Allows compiler to package individual functions in the form of packaged functions (COMDATs).
/Gz Specifies function calling conventions; not commonly used.
/O1 Optimizes for minimum size. Uses /Os as well as other switches.
/O2 Optimizes for maximum speed. Uses /Ot as well as other switches.
/Oa Tells compiler that your program does not use “aliasing” (a name that refers to a memory location already referred to by a different name).
/Ob Controls inline expansion of functions.
/Od Disables optimizations.
/Og Eliminates local and global common subexpressions, allows automatic register allocation, and allows loop optimization.
/Oi Replaces certain function calls with inline function expansion.
/Op Ensures the precision of floating point operations. This is useful when you are concerned about error propagation and intermediate results of floating point operations. The following topics contain information on understanding floating point operations: IEEE Floating-Point Representation and Microsoft Languages and Why Floating Point Numbers May Lose Precision.
/Os Favors smaller executable files.
/Ot Favors faster executable files.
/Ox Optimizes to use the fastest possible code. However, /O2 is recommended.
/Oy Suppresses creation of frame pointers on the call stack.
/Ow Tells compiler that your program does not use aliasing.