rabin@osf.org (Paul Rabin) (08/27/90)
ANSI C (4.1.6) says that except where otherwise specified, all library routines must be implemented as functions; additional macro implementations are permissible, but these must behave like functions. In particular, macro implementations of library functions must evaluate their arguments exactly once. In 4.6, setjmp is "otherwise specified": setjmp may be implemented as either a macro or a function. Conforming applications may not assume either that a function is defined or that a function is not defined. My question: Does ANSI C require that a macro implementation of setjmp evaluate its arguments exactly once? If so, do you have a suggestion for handling the jmp_buf argument? Thanks! -Paul Rabin
gwyn@smoke.BRL.MIL (Doug Gwyn) (08/28/90)
In article <12516@paperboy.OSF.ORG> rabin@osf.org (Paul Rabin) writes: > Does ANSI C require that a macro implementation of setjmp > evaluate its arguments exactly once? If so, do you have a > suggestion for handling the jmp_buf argument? Since 4.1.6 does not require it, I would say, no, the setjmp implementation may evaluate its argument more than once. This is also compatible with the intention of the setjmp/longjmp specification, for which I collected information about existing practice on an extremely wide variety of implementations.