volatile and typedef

Norman Diamond diamond at jit345.swstokyo.dec.com
Mon Apr 8 11:51:44 AEST 1991


In article <13698 at adobe.UUCP> taft at adobe.COM writes:
>  typedef int *int_ptr;
>  int_ptr pi;
>  volatile int_ptr vpi;
>  int test() {
>    vpi = pi;
>    return *vpi;
>  }
>My understanding is that the volatile type qualifier refers only to the
>variable vpi (used as an lvalue) and not to the thing it points to.
Mine too.  (Personal opinion.)

>This compiler does not claim to be ANSI-compliant,
>but it does support the volatile type qualifier
[Two incorrect warning messages.]
The warnings give the impression that it does not support volatile ... but ...
>The correct code appears to be generated in spite of the warnings.
... ah, so it does support volatile (as far as you and I know so far).

>Is the compiler wrong to complain about this usage,

An ANSI-compliant compiler may give any spurious error messages that it
wishes, as long as it correctly processes a strictly conforming program.
So, even an ANSI-conforming compiler could give the two incorrect warnings
that you quoted.

A non-ANSI-conforming compiler can do whatever it wants.

This non-ANSI-conforming compiler seems to come fairly close to conforming.

In both cases, quality of implementation is different from requirements.
If you tell your vendor that their product has an error, they might agree.
(Sorry, I don't know how to maximize the chance that they will agree.)

>or does the program really violate the standard in some way?
As far as I can see, the program does not violate the standard.
--
Norman Diamond       diamond at tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.



More information about the Comp.std.c mailing list