Recommends the minimum stack alignment size based on a power of 2.
#pragma stack_alignment( power )
power
Stack alignment value based on a power of 2.
By default, the global stack alignment is 4 as per the Win32 ABI. When doubles are accessed in a function, the alignment is bumped to 8 for that function. Spills of SSE registers (e.g. in autovectorized code or code using SSE intrinsics) bump alignment to 16 bytes.
Finally, the GCC-style __attribute__((aligned(xxx))) on a local variable declaration can be used to align specific variables, which in turn aligns the stack while use of #pragma disablopts off turns off stack alignment.
This pragma recommends a minimum alignment. When one of the above situations occurs, the actual alignment may be greater.
In some functions, in order to guarantee alignment, the EBX register is used as a surrogate local base pointer. This happens in functions which have indeterminate control flow (i.e., jump through a pointer), which are involved in exception handling, or which use alloca(). Use of EBX to access locals is not possible if Microsoft C++ exception handling is used in the function, so alignment is disabled for such functions. You can use #pragma warn_stack_alignment to check for such cases.