[Info-vax] Volatile, was: Re: yet another sys$qiow question

JF Mezei jfmezei.spamnot at vaxination.ca
Thu Aug 20 15:15:36 EDT 2015


On 15-08-20 12:12, Simon Clubley wrote:

> Will yes, that's how all compilers work because sys$qiow doesn't return
> control back to the program until it's completed so it's just like a
> normal subroutine call.

The compiler doesn't know that. The compiler would/should treat both QIO
and QIOW as possibly modifying a value during their execution. Even if
QIO only modifies it later, that variable should be marked as "possibly
modified" by the compiler for the next time you access it, whether the
instriuction right after a QIOW or 10 instructions after QIO. Right ?

> If you don't follow this rule, the compiler is allowed to assume that
> this data will be static during the lifetime of this block and is allowed
> to generate code accordingly.

I understand this. I am just puzzled on why this is the first time I
hear of "volatile" attribute.  I do recall some mechanism to prevent a
variable from being optimized into a register, but cant remember its
nomemclature (and some mechanisms that force a variable into a register
for when you call assembler code).

Learn something hew ecveryday, even if it is something I should have
known for 20 years (and never saw it in use in any code I looked at).



More information about the Info-vax mailing list