delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/02/09/15:04:01

Message-ID: <000b01c092d0$4b96c9c0$afe4883e@oemcomputer>
From: "Stephen Silver" <djgpp AT argentum DOT freeserve DOT co DOT uk>
To: "DJGPP Workers" <djgpp-workers AT delorie DOT com>
Subject: namespace std and libstdc++ V3
Date: Fri, 9 Feb 2001 19:41:25 -0000
MIME-Version: 1.0
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

In order to allow my namespace std patches to work with the libstdc++ V3
wrappers, I propose the following changes.

There would be a small include file that decides whether or not to use
namespace std.  It would look something like this:


/* Macros to control use of namespace std */

#ifdef __cplusplus

#if defined(_IN_C_LEGACY_) || (__GNUC__ == 2 && __GNUC_MINOR__ < 95)
#undef  __dj_use_namespace_std
#undef  __dj_namespace_std_begin
#undef  __dj_namespace_std_end
#define __dj_namespace_std_begin
#define __dj_namespace_std_end
#else
#define __dj_use_namespace_std
#undef  __dj_namespace_std_begin
#undef  __dj_namespace_std_end
#define __dj_namespace_std_begin namespace std {
#define __dj_namespace_std_end   }
#endif

#endif /* __cplusplus */


(The macro _IN_C_LEGACY_ is used by the libstdc++ V3 wrappers.  I've
added a test for the GCC version here as well, since when it's this
easy we may as well do it.)

Any header file that needs to use namespace std would #include
the above file, and would then use __dj_namespace_std_begin and
__dj_namespace_std_end to open and close namespace std, and would
use __dj_use_namespace_std in some situations where __cplusplus is
currently used.

Is this idea acceptable?  If so, what should the include file be called?

Stephen

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019