Skip to content

Commit 24d1c10

Browse files
committed
update per behavior verified Feb 2025
1 parent 5c020a6 commit 24d1c10

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

docs/preprocessor/check-stack.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: "Learn more about the check_stack pragma directive in Microsoft C/C
33
title: "check_stack pragma"
44
ms.date: 01/22/2021
55
f1_keywords: ["vc-pragma.check_stack", "check_stack_CPP"]
6-
helpviewer_keywords: ["check_stack pragma", "pragma, check_stack", "pragma, check_stack usage table"]
6+
helpviewer_keywords: ["check_stack pragma", "pragma, check_stack"]
77
no-loc: ["pragma"]
88
---
99
# `check_stack` pragma
@@ -17,19 +17,17 @@ Instructs the compiler to turn off stack probes if **`off`** (or **`-`**) is spe
1717
1818
## Remarks
1919

20+
This pragma only applies to 32-bit platforms (x86, ARM32). It has no effect on 64-bit platforms.
21+
2022
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.
2123

22-
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](../build/reference/compiler-options.md). The interaction of the `#pragma check_stack` and the [`/Gs`](../build/reference/gs-control-stack-checking-calls.md) option is summarized in the following table.
24+
`#pragma check_stack(off)` / `#pragma Check_stack-` is ignored if the size of the function locals is larger than 4096 or the value specified by `/Gs`.
2325

24-
### Using the check_stack Pragma
26+
The default behavior on is to insert stack probes at the beginning of each function if the size of the locals exceeds 4096 (or the value specified by `/Gs`) to ensure that the stack is large enough to accommodate the function's requirements.
2527

26-
| Syntax | Compiled with<br /><br /> `/Gs` option? | Action |
27-
|--|--|--|
28-
| `#pragma check_stack( )` or<br /><br /> `#pragma check_stack` | Yes | Turns off stack checking for functions that follow |
29-
| `#pragma check_stack( )` or<br /><br /> `#pragma check_stack` | No | Turns on stack checking for functions that follow |
30-
| `#pragma check_stack(on)`<br /><br /> or `#pragma check_stack +` | Yes or No | Turns on stack checking for functions that follow |
31-
| `#pragma check_stack(off)`<br /><br /> or `#pragma check_stack -` | Yes or No | Turns off stack checking for functions that follow |
28+
Use [/Gs (Control stack checking calls)](../build/reference/gs-control-stack-checking-calls.md) to change the threshold of the locals that trigger stack probes. Use with caution.
3229

3330
## See also
3431

32+
[Compiler options](../build/reference/compiler-options.md)\
3533
[Pragma directives and the `__pragma` and `_Pragma` keywords](./pragma-directives-and-the-pragma-keyword.md)

0 commit comments

Comments
 (0)