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

Johnny Billquist bqt at softjar.se
Thu Aug 20 14:26:49 EDT 2015


On 2015-08-20 17:05, Craig A. Berry wrote:
> On 8/20/15 9:52 AM, JF Mezei wrote:
>> On 15-08-20 10:45, Craig A. Berry wrote:
>>> On 8/20/15 8:54 AM, JF Mezei wrote:
>>>> So, after reading this, I am still puzzled...
>>>>
>>>> in DEC-C, how does one declare a variable as "volatile" ?
>>>
>>> As with any C compiler, using the "volatile" keyword, obviously:
>>
>> This is the first I ever heard of it, or seen it. And been doing $QIOs
>> since late 1980s. Pretty scary eh ?
>
> No, not really. If you do what you're supposed to you're fine. Only
> "busy-waiting" on the IOSB could run into the problems described in this
> thread. I've never seen code that does that. I'm not saying it doesn't
> exist, but I'm skeptical it's at all common.

That might be a bit optimistic and simplistic, but in general this is 
correct. Most code will not hit problems even though they haven't 
declared such variables as volatile. There is simply too much else going 
on in the code that the compiler will likely re-read the value from 
memory anyway sooner or later. But it all depends on how clever the 
compiler optimization is. Give the compilers a few more years, and they 
might become even more clever, and suddenly your code might indeed stop 
working.

	Johnny




More information about the Info-vax mailing list