Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 1.89 KB

check-stack.md

File metadata and controls

35 lines (25 loc) · 1.89 KB
description title ms.date f1_keywords helpviewer_keywords no-loc
Learn more about the check_stack pragma directive in Microsoft C/C++
check_stack pragma
01/22/2021
vc-pragma.check_stack
check_stack_CPP
check_stack pragma
pragma, check_stack
pragma, check_stack usage table
pragma

check_stack pragma

Instructs the compiler to turn off stack probes if off (or -) is specified, or to turn on stack probes if on (or +) is specified.

Syntax

#pragma check_stack( [{ on | off }] )
#pragma check_stack { + | - }

Remarks

This pragma takes effect at the first function defined after the pragma is seen. Stack probes are neither a part of macros nor of functions that are generated inline.

If you don't give an argument for the check_stack pragma, stack checking reverts to the behavior specified on the command line. For more information, see Compiler options. The interaction of the #pragma check_stack and the /Gs option is summarized in the following table.

Using the check_stack Pragma

Syntax Compiled with

/Gs option?
Action
#pragma check_stack( ) or

#pragma check_stack
Yes Turns off stack checking for functions that follow
#pragma check_stack( ) or

#pragma check_stack
No Turns on stack checking for functions that follow
#pragma check_stack(on)

or #pragma check_stack +
Yes or No Turns on stack checking for functions that follow
#pragma check_stack(off)

or #pragma check_stack -
Yes or No Turns off stack checking for functions that follow

See also

Pragma directives and the __pragma and _Pragma keywords