Shadow space example

The shadow space must be provided directly previous to the call. Imagine the shadow space as a relic from the old stdcall/cdecl convention: For WriteFile you needed five pushes. The shadow space stands for the last four pushes (the first four arguments). Now you need four registers, the shadow space (just the space, contents don’t … Read more

Class members and explicit stack/heap allocation

I think that you are confusing “stack/heap allocation” and “automatic variable”. Automatic variables are automatically destroyed when going out of context. Stack allocation is the fact that the memory is allocated on the execution stack. And variable allocated on the stack are automatic variables. Also, members are automatic variables whose destructors get called when its … Read more

Print out value of stack pointer

One trick, which is not portable or really even guaranteed to work, is to simple print out the address of a local as a pointer. void print_stack_pointer() { void* p = NULL; printf(“%p”, (void*)&p); } This will essentially print out the address of p which is a good approximation of the current stack pointer