2 ms·
For C standards before C11, C doesn't have a thread-aware memory model. The notion of threads suspending and waking up, or memory access from one thread's stack
by asdfasgasdgasdg 6y ago
For C standards before C11, C doesn't have a thread-aware memory model. The notion of threads suspending and waking up, or memory access from one thread's stack to another, does not exist in the standard, at least as far as I'm aware.
The C standard also doesn't define the memory layout of the stack, so there is no standard way to acquire the address of that variable. It's easy enough to see that compilers do not actually create storage for it: https://godbolt.org/z/cfE9o5 https://godbolt.org/z/cfE9o5
In C11 there is a thread aware memory model, but still no standard way to access that location, so compilers will assume it doesn't need to be created. https://godbolt.org/z/KTz9sT https://godbolt.org/z/KTz9sT