Mail Archives: djgpp-workers/2001/02/09/15:04:01
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 -