volatile

Karl Heuer karl at haddock.ISC.COM
Tue May 17 05:24:59 AEST 1988


In article <5367 at bloom-beacon.MIT.EDU> peter at athena.mit.edu (Peter J Desnoyers) writes:
>The debate over |volatile| seems to focus on one point: if this keyword is
>only necessary for non-portable code, why does it have to be part of the
>language?  [Goes on to discuss cross-compilers]

There's a simpler refutation: the premise is false.  The signal() function is
part of the standard library, and |volatile| is necessary for handlers of
asynchronous signals.  Earlier I posted a strictly conforming program which
contained some lines like:
  #include <signal.h>
  static volatile sig_atomic_t gotcha = 0;
  static void catch(int signo) { gotcha = 1; }
which argument has not been refuted to my knowledge.

If |volatile| were removed, we'd either have to go back to the old rules
(everything's volatile) or absorb its meaning into |sig_atomic_t|.

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint
Followups to comp.std.c.



More information about the Comp.std.c mailing list