Is there a difference between:
__declspec(align(8)) long long variable1;
InterlockedIncrement64(&variable1);
And this:
__declspec(align(8)) long long volatile variable2;
InterlockedIncrement64(&variable2);
I assume that they will work exactly the same in this scenario. I think the only difference would be that if it variable1is available without a locked function, it is not guaranteed as the current value, but is variable2guaranteed to be the current value. Example:
long long x = variable1;
long long y = variable2;
Am I correct in my assumptions? Note. I am using / volatile: ms compiler option in visual studio
source
share