volatile
Karl Heuer
karl at haddock.ISC.COM
Thu Mar 31 04:16:49 AEST 1988
In article <134 at wyse.wyse.com> mikew at wyse.UUCP (Mike Wexler) writes:
>In article <1988Mar29.004454.2867 at utzoo.uucp> henry at utzoo.uucp (Henry Spencer) writes:
>>the sort of code we're talking about isn't portable anyway.
>I would disagree that is isn't possible to write portable code that requires
>volatiles. An example(possibly the only one), is the use of System V
>or Berkeley shared memory.
Why drag shared memory into it? Isn't the following an example of a strictly
conforming program that needs volatile?
#include <signal.h>
static sig_atomic_t volatile gotcha;
static void catch(int signo) { gotcha = 1; }
int main(void) {
(void)signal(SIGINT, catch);
gotcha = 0;
do; while (!gotcha);
return (0);
}
Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint
More information about the Comp.lang.c
mailing list