[Info-vax] Volatile, was: Re: yet another sys$qiow question
John Reagan
xyzzy1959 at gmail.com
Wed Aug 19 13:47:27 EDT 2015
On Wednesday, August 19, 2015 at 12:58:05 PM UTC-4, VAXman- wrote:
> In article <>, Simon Clubley <> writes:
> >On 2015-08-19, VAXman- @SendSpamHere.ORG <> wrote:
> >> Question: If "volatile" is necessary, shouldn't this code keep spinning its
> >> tail???
> >>
> >
> >No, because you only have a function call in the loop (sys$qiow())
> >(and the function call additionally directly references iosb BTW).
> >
> >This means that regardless of whether the compiler terminates the
> >caching scope for iosb at any function call or whether it only
> >terminates the caching scope when a function call references iosb,
> >your code still causes the compiler to generate code to re-read the
> >current contents of the iosb variable after the function call returns.
> >
> >The current discussion is based around the belief C compilers terminate
> >the caching scope at any function call. I don't know if this is true
> >for all the other languages VMS supports.
>
> So, I should put the $QIO in a subroutine.
>
Well, the compiler saw that somebody took the address of the IOSB and passed it along to $QIO. The compiler doesn't know if that address was saved in some global variable. So the call to your jacket routine is still probably sufficient to tell the compiler (this routine call might write into every possible global variable and write into every variable whose address was ever taken).
More information about the Info-vax
mailing list