Print

Print


i had an e-mail exchange with Malcolm and the gist of it matches Bill's comment.  The meaning of "should" is spelled out in the ISO documents and it's a recommendation.  As in

“The processor should be accompanied by documentation that specifies the limits it imposes on the size and complexity of a program...”
However, good documentation isn't a requirement for the processor.  ;)

For programmers
"A pointer should have the VOLATILE attribute if its target has the VOLATILE attribute. If, by means not specified by the program, the target is referenced, defined, or becomes undefined, the pointer shall have the VOLATILE attribute."

The first sentence is a recommendation to the programmer--good style tip.  However, just because a variable is declared volatile it doesn't have to change by other means.  So, if you're sure the variable won't be volatilly changed you don't have to declare an associated pointer volatile; however, you should to avoid accidentally shooting yourself in the foot.  

The second sentence is a requirement on the programmer.  If the variable becomes volatilly changed while a pointer is associated with it, the pointer must also be volatile.

IMO, it's a lot like asynchronous variables.  They can be passed around to different subprograms and only have to be declared asynchronous if they are actually going to be pending I/O entities during execution of the routine.

 Dick Hendrickson

On Tue, Mar 14, 2017 at 10:37 AM, Anton Shterenlikht <[log in to unmask]> wrote:
Bill, thanks

Anton