setjmp/longjmp

Brian Thomson thomson at uthub.UUCP
Sat Nov 3 07:30:55 AEST 1984


While I agree that setjmp/longjmp SHOULD behave according to Gospel,
I have a great deal of sympathy for the implementation designer
who doesn't want to sacrifice the efficiency of his calling sequence
for the sake of longjmp.

There is a similar issue of whether to use a stack frame pointer.
Your call/return sequence will be faster if you don't, and you can
address everything relative to the sp.  All the frame pointer
buys you is the ability to get a calling trace from your favourite
core image debugger.  Is it worth it?

Some 780 instruction timings I did years ago indicated that the
CALLS/RET pair take ~15 microseconds minimum, while JSR/RTS execute
in 3.  That's a big penalty for the sake of setjmp(), calling traces,
and, oh yes, the infamous nargs().
-- 
		    Brian Thomson,	    CSRI Univ. of Toronto
		    {linus,ihnp4,uw-beaver,floyd,utzoo}!utcsrgv!uthub!thomson



More information about the Comp.lang.c mailing list