|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
/Gs (Control Stack Checking Calls)
Controls stack probes.
This option is an advanced feature to control stack probes. A stack probe is a sequence of code the compiler inserts into every function call. When activated, a stack probe reaches benignly into memory by the amount of space required to store the associated function's local variables.
If a function requires more than size bytes of stack space for local variables, its stack probe is activated. The default value of size is the size of one page:
4 KB for x86
4 KB for x64
8 KB for Itanium
This value allows an application and the Windows memory manager to increase the amount of memory committed to the program stack at run time.
The default value of size allows the program stack of applications for Windows to properly grow at run time. Do not change the default setting of /Gs unless you know exactly why you need to change it.
Some programs, such as virtual device drivers, do not require this default stack-growth mechanism. In such cases, the stack probes are not necessary. You can stop the compiler from generating stack probes by setting size to a value that is larger than any function will require for local variable storage. No space is allowed between /Gs and size.
/Gs0 has the same effect as /Ge (Enable Stack Probes).
You can turn stack probes on or off by using check_stack. Note that /Gs and the check_stack pragma have no effect on standard C library routines; they affect only the functions you compile.
To set this compiler option in the Visual Studio development environment
Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.
Click the C/C++ folder.
Click the Command Line property page.
Type the compiler option in the Additional Options box.
To set this compiler option programmatically