Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!ames!mindcraft.com!mindcraft.com!fred From: fred@mindcraft.com (Fred Zlotnick) Newsgroups: comp.std.c Subject: Must setjmp() be a macro? Message-ID: <669072342.15719@mindcraft.com> Date: 15 Mar 91 21:25:38 GMT Organization: Mindcraft, Inc. Lines: 36 >from: fred@mindcraft.com (Fred Zlotnick) I'm having trouble understanding what the C standard requires of setjmp(). Section 4.6 starts out with The header defines the macro setjmp and declares one function [longjmp] and one type [jmp_buf] ... This would seem to imply that setjmp() must be implemented as a macro on a conforming implementation. However, later in the same section, it states It is unspecified whether setjmp is a macro or an identifier with external linkage. This seems to imply the opposite: that the implementor has a choice. The rationale doesn't help much. So what is the consensus of the newsgroup, and of the C standard experts therein? One system in our lab that claims ANSI C conformance has a that includes lines like these: #if __STDC__ == 1 extern int setjmp(jmp_buf env); #define setjmp(X) setjmp(X) #endif Another system in our lab, also claiming ANSI conformance, has the prototype but not the macro. Clearly I'm not the only one who's confused. Note that, as Chuck Karish has pointed out to me, this has implications for POSIX.1. In that standard it states (8.3.1.2) that The sigsetjmp() macro shall comply with the definition of the setjmp() macro in the C Standard. ---- Fred Zlotnick | #include fred@mindcraft.com | #include ...!{decwrl,ames,hpda}!mindcrf!fred |