This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Namespace implementation in the compiler
- To: NAHMED1 at motorola dot com, gcc at gcc dot gnu dot org
- Subject: Re: Namespace implementation in the compiler
- From: mike stump <mrs at windriver dot com>
- Date: Sun, 8 Jul 2001 12:19:15 -0700 (PDT)
> From: Ahmed Nazir-NAHMED1 <NAHMED1@motorola.com>
> To: "'gcc@gcc.gnu.org'" <gcc@gcc.gnu.org>
> Date: Mon, 2 Jul 2001 12:27:09 -0500
> How do I know if the compiler supports the namespace. Is there is
> any macro defined for these.
Yes, from the manual:
@item __GNUC__
@findex __GNUC__
This macro is defined if and only if this is GNU C@. This macro is
defined only when the entire GNU C compiler is in use; if you invoke the
preprocessor directly, @samp{__GNUC__} is undefined. The value
identifies the major version number of GNU CC (@samp{1} for GNU CC
version 1, which is now obsolete, and @samp{2} for version 2).
@item __GNUC_MINOR__
@findex __GNUC_MINOR__
The macro contains the minor version number of the compiler. This can
be used to work around differences between different releases of the
compiler (for example, if GCC 2.6.x is known to support a feature, you
can test for @code{__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6)}).
@item __GNUC_PATCHLEVEL__
@findex __GNUC_PATCHLEVEL__
This macro contains the patch level of the compiler. This can be
used to work around differences between different patch level releases
of the compiler (for example, if GCC 2.6.2 is known to contain a bug,
whereas GCC 2.6.3 contains a fix, and you have code which can workaround
the problem depending on whether the bug is fixed or not, you can test for
@code{__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 6) ||
(__GNUC__ == 2 && __GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ >= 3)}).
If __GNUC__ >= 3, namespaces should work as well as they do in 3.0.
You might be able to use namespaces from 2.95 and later, you'd have to
test and see if that works for you.