Article View: comp.std.c
Article #2553Must setjmp() be a macro?
From: Fred Zlotnick
Date: Fri, 15 Mar 1991 21:25
Date: Fri, 15 Mar 1991 21:25
36 lines
1806 bytes
1806 bytes
I'm having trouble understanding what the C standard requires of setjmp().
Section 4.6 starts out with
The header <setjmp.h> 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 <setjmp.h> 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 <std.disclaimer>
fred@mindcraft.com | #include <brilliant.quote>
...!{decwrl,ames,hpda}!mindcrf!fred |
Technical Details
Message-ID:
<669072342.15719@mindcraft.com>Path:
arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!ames!mindcraft.com!mindcraft.com!fredShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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)