volatile registers

Chris Torek chris at mimsy.UUCP
Fri Jan 6 15:20:17 AEST 1989


>In article <2337 at cuuxb.ATT.COM> dlm at cuuxb.ATT.COM (Dennis L. Mumaugh) writes:
>>The concept "volatile" should not occur in any general C program.
>>This feature exists only for the stand alone, the real time and
>>the kernel hacker.

In article <1103 at houxs.ATT.COM> beyer at houxs.ATT.COM (J.BEYER) writes:
>I disagree with this statement.
>Consider a program with a global variable that can be accessed by the
>'main' program and a signal handler. ...

I forget whether using signal handlers and `sig_atomic_t' gives a
strictly conformant program.  Note, though, that in this case the
variable cannot be declared `register' as it is global or static.
[see subject: header]

(This, and setjmp/longjmp, are probably the only two places where
strictly conformant programs need the volatile qualifier.  I believe
that the qualifier, if present, is hidden underneath the sig_atomic_t
typedef.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.std.c mailing list