[Info-vax] Volatile, was: Re: yet another sys$qiow question
JF Mezei
jfmezei.spamnot at vaxination.ca
Thu Aug 20 11:43:41 EDT 2015
On 15-08-20 11:19, John Reagan wrote:
> Correct. If all you do is declare the IOSB, pass it to $QIO and don't read it until the EF or AST is delivered, the lack of volatile is probably not important.
Say I set the IOSB to zeroes,
call QIOW passing IOSB
then check IOSB to make sure IO completed with success.
Would the compiler realise that QIOW could modify the IOSB and thus make
sure that when I check the IOSB, it doesn't assume it is still set to 0s ?
So, if I use QIO instead of QIOW, wouldn't the compiler also flag IOSB
as potentially having been modified, so the next time it is read, it
needs to be read from memory ?
I realise that once in a loop that checks IOSB, the compiler wouldn't
see any other potential modification of IOSB within the loop and
optimize it away.
I learned that whenever I need to use the debugger, to always
CC/nooptimize , but never really considered cases where an AST
modifying a variable (or the driver itself) would not result in my code
seeing the updated value.
More information about the Info-vax
mailing list