Редактиране

Споделяне чрез


/Oy (Frame-Pointer Omission)

Suppresses creation of frame pointers on the call stack.

Syntax

/Oy[-]

Remarks

This option speeds function calls, because no frame pointers need to be set up and removed. It also frees one more register for general usage.

/Oy enables frame-pointer omission and /Oy- disables omission. In x64 compilers, /Oy and /Oy- are not available.

If your code requires frame-based addressing, you can specify the /Oy- option after the /Ox option or use optimize with the "y" and off arguments to gain maximum optimization with frame-based addressing. The compiler detects most situations where frame-based addressing is required (for instance, with the _alloca and setjmp functions and with structured exception handling).

The /Ox (Enable Most Speed Optimizations) and /O1, /O2 (Minimize Size, Maximize Speed) options imply /Oy. Specifying /Oy- after the /Ox, /O1, or /O2 option disables /Oy, whether it is explicit or implied.

The /Oy compiler option makes using the debugger more difficult because the compiler suppresses frame pointer information. If you specify a debug compiler option (/Z7, /Zi, /ZI), we recommend that you specify the /Oy- option after any other optimization compiler options.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.

  2. Select the Configuration Properties > C/C++ > Optimization property page.

  3. Modify the Omit Frame Pointers property. This property adds or removes only the /Oy option. If you want to add the /Oy- option, select the Command Line property page and modify Additional options.

To set this compiler option programmatically

See also

/O Options (Optimize Code)
MSVC Compiler Options
MSVC Compiler Command-Line Syntax