I know about volatile
variables that are defined at file scope. The compiler isn't allowed to make assumptions about these variables. They may be changed at nearly any time and the compile must not optimize out reads of the variable.
Now I found this code
BOOL InstallHandler()
{
volatile BOOL b_bulk_erase = FALSE;
volatile BOOL b_test_read_write = FALSE;
volatile BOOL b_continue = TRUE;
...
if (b_test_read_write)
{
read();
write();
}
}
How does the volatile
corresponds to variables to the stack i.e. owned by one thread?
Edit:
With owned by one thread I wanted to express that the variable is not exposed. The address isn't given to anything else. It is not used by any other thread.