setjmp: read the manual
Dick Dunn
rcd at opus.UUCP
Fri Oct 19 17:40:15 AEST 1984
Regarding the setjmp/longjmp interaction with register variables...
dmr gave one approach and justified it on the basis of "correct" behavior.
A response...
> There's a good reason for doing it the other way: efficiency...
Did I really miss something, or did someone just tell us that it is
reasonable to compromise correctness for efficiency? I have a tough time
with such compromises.
>...
> We looked hard at this and decided to change the meaning of
> setjmp/longjmp (to the above) rather than having EVERY function save...
The parent article goes on to describe problems with saving all the
registers on a 68000. In fact, there is a "whizzo" (his words) instruction
on the 68000 to save whatever set of registers you need, and you clearly
won't need to save all of them.
>...
> To fix a program that this breaks, you remove "register" declarations from
> routines that call setjmp. Not so bad.
Actually, the task of fixing a program that breaks is a little harder:
First you have to realize that the problem is a setjmp/register
interaction. Realistically, that might take days to find (particularly
if you're porting someone else's code). I can't call that "not so bad".
--
Dick Dunn {hao,ucbvax,allegra}!nbires!rcd (303)444-5710 x3086
...Lately it occurs to me what a long, strange trip it's been.
More information about the Comp.lang.c
mailing list