saker.msvc Documentation TaskDoc JavaDoc Packages
Simple compiler option that is directly passed to cl.exe on the command line.
Summary
Enumeration values
/EHaEnables standard C++ stack unwinding.
/EHarIncludes both /EHa and /EHr.
/EHcWhen used with /EHs, the compiler assumes that functions declared as extern "C" never throw a C++ exception.
/EHrTells the compiler to always generate runtime termination checks for all noexcept functions.
/EHsEnables standard C++ stack unwinding.
/EHscIncludes both /EHs and /EHc.
/EHscrIncludes /EHs, /EHc and /EHr.
/GAOptimize for Windows Application.
/GFEliminate Duplicate Strings.
/GLEnables whole program optimization.
/GREnable Run-Time Type Information.
/GSBuffer Security Check.
/GTSupport fiber-safe thread-local storage.
/GdDetermines the order in which function arguments are pushed onto the stack, whether the caller function or called function removes the arguments from the stack at the end of the call, and the name-decorating convention that the compiler uses to identify individual functions.
/GrDetermines the order in which function arguments are pushed onto the stack, whether the caller function or called function removes the arguments from the stack at the end of the call, and the name-decorating convention that the compiler uses to identify individual functions.
/GvDetermines the order in which function arguments are pushed onto the stack, whether the caller function or called function removes the arguments from the stack at the end of the call, and the name-decorating convention that the compiler uses to identify individual functions.
/GwOptimize Global Data.
/GyEnable Function-Level Linking.
/GzDetermines the order in which function arguments are pushed onto the stack, whether the caller function or called function removes the arguments from the stack at the end of the call, and the name-decorating convention that the compiler uses to identify individual functions.
/LDCreates a DLL.
/LDdCreates a debug DLL.
/MDCauses the application to use the multithread-specific and DLL-specific version of the run-time library.
/MDdDefines _DEBUG, _MT, and _DLL and causes the application to use the debug multithread-specific and DLL-specific version of the run-time library.
/MTCauses the application to use the multithread, static version of the run-time library.
/MTdDefines _DEBUG and _MT.
/O1Optimization option to minimize size.
/O2Optimization option to maximize speed.
/Ob0Controls inline expansion of functions.
/Ob1Controls inline expansion of functions.
/Ob2Controls inline expansion of functions.
/Ob3Controls inline expansion of functions.
/OdDisable optimization (Debug mode).
/OgProvides local and global optimizations, automatic-register allocation, and loop optimization.
/OiGenerate Intrinsic Functions.
/OsFavor Small Code.
/OtFavor Fast Code Maximizes the speed of EXEs and DLLs by instructing the compiler to favor speed over size.
/OxEnable Most Speed Optimizations.
/OySuppresses creation of frame pointers on the call stack.
/RTC1Run-time error checks.
/RTCcRun-time error checks.
/RTCsRun-time error checks.
/RTCuRun-time error checks.
/W0/W0 suppresses all warnings.
/W1/W1 displays level 1 (severe) warnings.
/W2/W2 displays level 1 and level 2 (significant) warnings.
/W3/W3 displays level 1, level 2, and level 3 (production quality) warnings.
/W4/W4 displays level 1, level 2, and level 3 warnings, and all level 4 (informational) warnings that aren't off by default.
/WXTreats all compiler warnings as errors.
/WallDisplays all warnings displayed by /W4 and all other warnings that /W4 doesn't include—for example, warnings that are off by default.
/bigobjIncreases the number of sections that an object file can contain.
/sdlEnable Additional Security Checks.
/utf-8Specifies both the source character set and the execution character set as UTF-8.
/volatile:isoSpecifies how the volatile keyword is to be interpreted.
/volatile:msSpecifies how the volatile keyword is to be interpreted.
/wSuppresses all compiler warnings.
Enumeration values
Enables standard C++ stack unwinding. Catches both structured (asynchronous) and standard C++ (synchronous) exceptions when you use catch(...) syntax. /EHa overrides both /EHs and /EHc arguments.
Includes both /EHa and /EHr.
When used with /EHs, the compiler assumes that functions declared as extern "C" never throw a C++ exception. It has no effect when used with /EHa (that is, /EHca is equivalent to /EHa). /EHc is ignored if /EHs or /EHa aren't specified.
Tells the compiler to always generate runtime termination checks for all noexcept functions. By default, runtime checks for noexcept may be optimized away if the compiler determines the function calls only non-throwing functions. This option gives strict C++ conformance at the cost of some extra code. /EHr is ignored if /EHs or /EHa aren't specified.
Enables standard C++ stack unwinding. Catches only standard C++ exceptions when you use catch(...) syntax. Unless /EHc is also specified, the compiler assumes that functions declared as extern "C" may throw a C++ exception.
Includes both /EHs and /EHc.
Includes /EHs, /EHc and /EHr.
Optimize for Windows Application. Results in more efficient code for an .exe file for accessing thread-local storage (TLS) variables.
Eliminate Duplicate Strings. Enables the compiler to create a single copy of identical strings in the program image and in memory during execution. This is an optimization called string pooling that can create smaller programs. /GF is in effect when /O1 or /O2 is used.
Enables whole program optimization. Whole program optimization allows the compiler to perform optimizations with information on all modules in the program. Without whole program optimization, optimizations are performed on a per-module (compiland) basis.
Enable Run-Time Type Information. Adds code to check object types at run time. When /GR is on, the compiler defines the _CPPRTTI preprocessor macro. By default, /GR is on.
Buffer Security Check. Detects some buffer overruns that overwrite a function's return address, exception handler address, or certain types of parameters. Causing a buffer overrun is a technique used by hackers to exploit code that does not enforce buffer size restrictions. /GS is on by default.
Support fiber-safe thread-local storage. Supports fiber safety for data allocated using static thread-local storage, that is, data allocated with __declspec(thread). Data declared with __declspec(thread) is referenced through a thread-local storage (TLS) array. The TLS array is an array of addresses that the system maintains for each thread. Each address in this array gives the location of thread-local storage data. A fiber is a lightweight object that consists of a stack and a register context and can be scheduled on various threads. A fiber can run on any thread. Because a fiber may get swapped out and restarted later on a different thread, the compiler mustn't cache the address of the TLS array, or optimize it as a common subexpression across a function call. /GT prevents such optimizations.
Determines the order in which function arguments are pushed onto the stack, whether the caller function or called function removes the arguments from the stack at the end of the call, and the name-decorating convention that the compiler uses to identify individual functions. /Gd, the default setting, specifies the __cdecl calling convention for all functions except C++ member functions and functions that are marked __stdcall, __fastcall, or __vectorcall.
Determines the order in which function arguments are pushed onto the stack, whether the caller function or called function removes the arguments from the stack at the end of the call, and the name-decorating convention that the compiler uses to identify individual functions. /Gr specifies the __fastcall calling convention for all functions except C++ member functions, functions named main, and functions that are marked __cdecl, __stdcall, or __vectorcall. All __fastcall functions must have prototypes. This calling convention is only available in compilers that target x86, and is ignored by compilers that target other architectures.
Determines the order in which function arguments are pushed onto the stack, whether the caller function or called function removes the arguments from the stack at the end of the call, and the name-decorating convention that the compiler uses to identify individual functions. /Gz specifies the __stdcall calling convention for all functions except C++ member functions, functions named main, and functions that are marked __cdecl, __fastcall, or __vectorcall. All __stdcall functions must have prototypes. This calling convention is only available in compilers that target x86, and is ignored by compilers that target other architectures.
Optimize Global Data. Package global data in COMDAT sections for optimization. The /Gw option causes the compiler to package global data in individual COMDAT sections. By default, /Gw is off and must be explicitly enabled. When both /Gw and /GL are enabled, the linker uses whole-program optimization to compare COMDAT sections across multiple object files in order to exclude unreferenced global data or to merge identical read-only global data. This can significantly reduce the size of the resulting binary executable.
Enable Function-Level Linking. Allows the compiler to package individual functions in the form of packaged functions (COMDATs).
Determines the order in which function arguments are pushed onto the stack, whether the caller function or called function removes the arguments from the stack at the end of the call, and the name-decorating convention that the compiler uses to identify individual functions. /Gv specifies the __vectorcall calling convention for all functions except C++ member functions, functions named main, functions with a vararg variable argument list, or functions that are marked with a conflicting __cdecl, __stdcall, or __fastcall attribute. This calling convention is only available on x86 and x64 architectures that support /arch:SSE2 and above, and is ignored by compilers that target the ARM architecture.
Creates a DLL. Passes the /DLL option to the linker. The linker looks for, but does not require, a DllMain function. If you do not write a DllMain function, the linker inserts a DllMain function that returns TRUE. Links the DLL startup code. Creates an import library (.lib), if an export (.exp) file is not specified on the command line. You link the import library to applications that call your DLL. Implies /MT unless you explicitly specify /MD.
Creates a debug DLL. Defines _MT and _DEBUG.
Causes the application to use the multithread-specific and DLL-specific version of the run-time library. Defines _MT and _DLL and causes the compiler to place the library name MSVCRT.lib into the .obj file.
Defines _DEBUG, _MT, and _DLL and causes the application to use the debug multithread-specific and DLL-specific version of the run-time library. It also causes the compiler to place the library name MSVCRTD.lib into the .obj file.
Causes the application to use the multithread, static version of the run-time library. Defines _MT and causes the compiler to place the library name LIBCMT.lib into the .obj file so that the linker will use LIBCMT.lib to resolve external symbols.
Defines _DEBUG and _MT. This option also causes the compiler to place the library name LIBCMTD.lib into the .obj file so that the linker will use LIBCMTD.lib to resolve external symbols.
Optimization option to minimize size. Equivalent to /Og /Os /Oy /Ob2 /GF /Gy.
Optimization option to maximize speed. Equivalent to /Og /Oi /Ot /Oy /Ob2 /GF /Gy.
Controls inline expansion of functions. The default value under /Od. Disables inline expansions.
Controls inline expansion of functions. Allows expansion only of functions marked inline, __inline, or __forceinline, or in a C++ member function defined in a class declaration.
Controls inline expansion of functions. The default value under /O1 and /O2. Allows the compiler to expand any function not explicitly marked for no inlining.
Controls inline expansion of functions. This option specifies more aggressive inlining than /Ob2, but has the same restrictions. The /Ob3 option is available starting in Visual Studio 2019.
Disable optimization (Debug mode). Turns off all optimizations in the program and speeds compilation.
Deprecated.
Provides local and global optimizations, automatic-register allocation, and loop optimization. Deprecated. It's recommend that you use either /O1 (Minimize Size) or /O2 (Maximize Speed) instead.
Generate Intrinsic Functions. Replaces some function calls with intrinsic or otherwise special forms of the function that help your application run faster.
Favor Small Code. Minimizes the size of EXEs and DLLs by instructing the compiler to favor size over speed.
Favor Fast Code Maximizes the speed of EXEs and DLLs by instructing the compiler to favor speed over size. /Ot is the default when optimizations are enabled.
Enable Most Speed Optimizations. The /Ox compiler option enables the /O compiler options that favor speed. The /Ox compiler option doesn't include the additional /GF (Eliminate Duplicate Strings) and /Gy (Enable Function-Level Linking) options enabled by /O1 or /O2 (Minimize Size, Maximize Speed). The additional options applied by /O1 and /O2 can cause pointers to strings or to functions to share a target address, which can affect debugging and strict language conformance. The /Ox option is an easy way to enable most optimizations without including /GF and /Gy. For more information, see the descriptions of the /GF and /Gy options.
Suppresses creation of frame pointers on the call stack.
Run-time error checks. Used to enable and disable the run-time error checks feature, in conjunction with the runtime_checks pragma. Equivalent to /RTCsu.
Run-time error checks. Used to enable and disable the run-time error checks feature, in conjunction with the runtime_checks pragma. Reports when a value is assigned to a smaller data type and results in a data loss. For example, it reports if a short type value of 0x0101 is assigned to a variable of type char.
Run-time error checks. Used to enable and disable the run-time error checks feature, in conjunction with the runtime_checks pragma. Enables stack frame run-time error checking, such as: - Initialization of local variables to a nonzero value. - Detection of overruns and underruns of local variables such as arrays. - Stack pointer verification, which detects stack pointer corruption.
Run-time error checks. Used to enable and disable the run-time error checks feature, in conjunction with the runtime_checks pragma. Reports when a variable is used without having been initialized.
/W0 suppresses all warnings. It's equivalent to /w.
/W1 displays level 1 (severe) warnings. /W1 is the default setting in the command-line compiler.
/W2 displays level 1 and level 2 (significant) warnings.
/W3 displays level 1, level 2, and level 3 (production quality) warnings.
/W4 displays level 1, level 2, and level 3 warnings, and all level 4 (informational) warnings that aren't off by default.
Treats all compiler warnings as errors.
Displays all warnings displayed by /W4 and all other warnings that /W4 doesn't include—for example, warnings that are off by default.
Increases the number of sections that an object file can contain. By default, an object file can hold up to 65,279 (almost 2^16) addressable sections. This limit applies no matter which target platform is specified. /bigobj increases that address capacity to 4,294,967,296 (2^32).
Enable Additional Security Checks. Enables recommended Security Development Lifecycle (SDL) checks. These checks change security-relevant warnings into errors, and set additional secure code-generation features.
Specifies both the source character set and the execution character set as UTF-8.
Specifies how the volatile keyword is to be interpreted. Selects strict volatile semantics as defined by the ISO-standard C++ language. Acquire/release semantics are not guaranteed on volatile accesses. If the compiler targets ARM (except ARM64EC), this is the default interpretation of volatile.
Specifies how the volatile keyword is to be interpreted. Selects Microsoft extended volatile semantics, which add memory ordering guarantees beyond the ISO-standard C++ language. Acquire/release semantics are guaranteed on volatile accesses. However, this option also forces the compiler to generate hardware memory barriers, which might add significant overhead on ARM and other weak memory-ordering architectures. If the compiler targets ARM64EC or any non-ARM platform, this is default interpretation of volatile.
Suppresses all compiler warnings.