Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!texsun!texsun.central-relay.sun.com!convex!sneaky!authorplaceholder From: gordon@sneaky.UUCP Newsgroups: comp.lang.c Subject: Re: Volatile is Necessary Message-ID: <-63852956@sneaky> Date: 2 Apr 88 19:33:00 GMT References: <7569@brl-smoke.ARPA> Lines: 27 Nf-ID: #R:brl-smoke.ARPA:-756900:sneaky:-63852956:000:1170 Nf-From: sneaky.UUCP!gordon Apr 2 14:33:00 1988 > The |setjmp| macro shall be implemented as a macro, not as an > actual function. If the macro definition is suppressed in order > to access an actual function, the behavior is undefined. > No reason is given here for this requirement (which, incidentally, > makes it technically illegal NOT to |#define setjmp| as something, even > if it is just as |_setjmp|), but it would make sense if it were > intended as a constraint on the *programmer* so that || could > say, e.g., > #define setjmp(env) _builtin_setjmp(env) I interpret the requirement that setjmp be implemented as a macro as requiring that you cannot (portably) take the address of setjmp, and put it in a function pointer. Therefore, the compiler may assume that all calls through function pointers are NOT calls to setjmp. Further, you can make the compiler recognize all calls to setjmp, by doing things like: # define setjmp(env) (_builtin_setjmp(env) + 0) where the +0 ensures that &setjmp draws an error message, and the name _builtin_setjmp is recognized by the compiler and makes it flush out common subexpressions, etc. Gordon Burditt ...!ihnp4!sys1!sneaky!gordon