Volatile is Necessary

Henry Spencer henry at utzoo.uucp
Sat Apr 2 09:31:29 AEST 1988


> 	My guess is that some kind of declaration of setjmp itself
> is necessary, to let the compiler know that nothing can be trusted
> across this function call...

If you inspect the X3J11 rules about setjmp carefully, you will see a
set of restrictions aimed at making it easy for compilers to recognize
it as a special case.  Optimizing compilers undoubtedly will.  Non-
optimizing compilers will simply have to be a bit conservative.  This
is not a disaster.

The current rules about automatic variables *are* a bit of a disaster,
but nobody in his right mind will implement them (and some of us are
going to try to get them changed).  The traditional rule, that only
explicitly-register variables are unsafe after longjmp, is adequate:
any compiler that is smart enough to promote things into registers
without being asked is smart enough to notice the setjmp and take
precautions.
-- 
"Noalias must go.  This is           |  Henry Spencer @ U of Toronto Zoology
non-negotiable."  --DMR              | {allegra,ihnp4,decvax,utai}!utzoo!henry



More information about the Comp.lang.c mailing list