[comp.lang.c] Comments on setjmp

williams%nrl-css.arpa@nrl-css.arpa (04/01/88)

	Several people have made comments on setjmp that I think I can make
useful comments on.  Chris Torek wondered why setjump is required to be
a macro.  The answer to this is in the rationale.  I assume that Global
Engineering is sending this out with all copies of the Draft...

	From the Rationale, X3J11/88-004, and using |text| to delimit
	things in "typewriter" font.

	"|setjump| is constrained to be a macro only:  in some
	implementations the information necessary to restore context is
	only available while executing the function making [the] call
	to |setjmp|."

(The word "the" in brackets is "to" in the document, but this must be a
typo.)

So, somebody must have an implemention which would not know enough inside a
function setjmp() to be able to save the required context.  I'm not an
implementor, and have no idea who has such an architecture.  The Rationale
goes on to discuss the various levels of constraint that have been 
suggested for setjmp().  To answer another question posted recently, yes
we are aware that if setjmp() is called inside a complex expression then
the temporaries involved may not (probably won't) be what they were when
setjmp was originally called.

My own, personal, opinion is that setjmp should be a keyword.  The committee
considered that, but decided it was too radical a change.   In general,
a new keyword has been added ONLY if there was no other way to get the
desired functionality, and then only with great reluctance.  After noalias,
though, I'm not sure anyone will believe THAT...

Jim Williams
X3J11

The opinions above are mine.

 ------------------------------------------------------------
There is no 'd' in "kluge"!  It rhymes with "deluge", not "sludge".

James W. Williams			williams@nrl-css.arpa
Systems Administrator, Code 5505
Information Technology Division		
Naval Research Laboratory		(202) 767-9035
Washington, DC 20375
 ------------------------------------------------------------