I know the volatile modifier has been discussed a lot. Please don't yell at me. I know why it is used, but I am trying to properly use it in my multi threaded C program using Visual Studio 2008 and 2010. Been having some trouble with it on Windows 10. Does it matter where I place the modifier in a simple declaration? For example, both of these build successfully but I was wondering if there was any difference in the meaning to the compiler:
// difference if any between these two?
volatile char _initialized = 0;
char volatile _initialized = 0;
What about a more complex declaration? Given this structure:
typedef struct _KEY_HANDLE
{
ULONG handle;
void *ptr;
} KEY_HANDLE;
...
// difference if any between these three
volatile KEY_HANDLE * key_handles = NULL;
KEY_HANDLE volatile * key_handles = NULL;
KEY_HANDLE * volatile key_handles = NULL;
...
key_handles = (PVOID) malloc(bufsz);
...
Thanks.