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

David Froble davef at tsoft-inc.com
Fri Aug 21 08:16:14 EDT 2015


Johnny Billquist wrote:
> On 2015-08-20 17:00, Bob Gezelter wrote:
>> On Thursday, August 20, 2015 at 10:53:01 AM UTC-4, 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 ?
>>
>> JF,
>>
>> Actually, not.
>>
>> The standard way (as Hoff has said) is to either use an event flag or 
>> an AST. Either of these work as defined, and the OpenVMS IO Post 
>> processing is responsible for ensuring that your memory is in a 
>> consistent state when the IO is "completed".
> 
> volatile have nothing to do with your memory being consistent. It is 
> about how the compiler is allowed to optimize access to the memory. The 
> memory can hold correct content, but the compiled code never reads it.
> 
>> The problem arises when one checks the contents of an IOSB upon which 
>> one has not received one of the normal completion indicators (e.g, 
>> spinning on the IOSB contents; checking to see if other IO's have 
>> completed when receiving an AST on a different IO).
> 
> Uh... No... The problem arises when you repeatedly reads a value. If it 
> isn't declared volatile, the compiler might "know" that the value have 
> not changed from one read to the next, and thus can optimize away 
> subsequent reads.
> 
>     Johnny
> 

Uh... No... The problem arises when rather poor coding practice is used.  I 
really would hope that none of the manuals or examples suggests reading the IOSB 
prior to the operation being signaled as complete.

I understand what you're saying the volatile command does, but so far I don't 
think I've seen an example that needs it, except for what I'd consider improper 
coding.



More information about the Info-vax mailing list