Message-ID: <002b01c091ff$1bc5a6c0$a2d9883e@oemcomputer> From: "Stephen Silver" To: "DJGPP Workers" Subject: Re: setjmp.h - namespace std patch Date: Thu, 8 Feb 2001 18:44:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Reply-To: djgpp-workers AT delorie DOT com Eli Zaretskii wrote: > On Thu, 8 Feb 2001, Stephen Silver wrote: > > > 17.4.1.2 paragraph 5: > > > > Names which are defined as macros in C shall be defined as > > macros in the C++ Standard Library, even if C grants license for > > implementation as functions. [Note: the names defined as macros > > in C include the following: assert, errno, offsetof, setjmp, > > va_arg, va_end, and va_start. —end note] > > This seems to indicate that setjmp should be a macro in C as well. > perhaps we need to make "#define setjmp setjmp" be visible even outside > #ifdef __cplusplus. It's not absolutely necessary to do this in C, as C does permit a non-macro implemention. But it's harmless, so I've done it this way. The following patch is the same as the original one, except for adding one extra line. Stephen *** include/setjmp.h.old Thu Jun 3 17:22:28 1999 --- include/setjmp.h Thu Feb 8 18:29:28 2001 *************** *** 5,8 **** --- 5,9 ---- #ifdef __cplusplus + namespace std { extern "C" { #endif *************** *** 22,25 **** --- 23,27 ---- void longjmp(jmp_buf env, int val); int setjmp(jmp_buf env); + #define setjmp setjmp /* required by C++ standard */ #ifndef __STRICT_ANSI__ *************** *** 41,45 **** --- 43,68 ---- #ifdef __cplusplus } + } #endif #endif /* !__dj_include_setjmp_h_ */ + + + #if defined(__cplusplus) && !defined(__dj_ENFORCE_ANSI_FREESTANDING) + + using std::setjmp; + + #ifndef __dj_via_cplusplus_header_ + + using std::longjmp; + using std::jmp_buf; + + #ifndef __STRICT_ANSI__ + + using std::sigjmp_buf; + using std::sigsetjmp; + using std::siglongjmp; + + #endif /* !__STRICT_ANSI__ */ + #endif /* !__dj_via_cplusplus_header_ */ + #endif /* __cplusplus && !__dj_ENFORCE_ANSI_FREESTANDING */