This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Namespaces and pre-processing directives
- From: Matthieu Moy <Matthieu dot Moy at imag dot fr>
- To: "Megha Murarka" <megha at poseidontech dot com>
- Cc: "gcc-help" <gcc-help at gcc dot gnu dot org>
- Date: Fri, 04 Apr 2003 12:42:16 +0200
- Subject: Re: Namespaces and pre-processing directives
- References: <1038476880.12170.ezmlm@gcc.gnu.org><007a01bfdf54$30b553e0$1801a8c0@blr.vsnl.net.in><002101c2fa93$c520e8c0$1801a8c0@blr.vsnl.net.in>
"Megha Murarka" <megha at poseidontech dot com> writes:
> The program given below compiles fine.
> but if we use the statement ,
> int x = MYSPACE::VALUE +1;
> It gives an error. Why is it so ? (when the #define is present inside the
> scope of the namespace ) ????
#define are managed by the preprocessor, which isn't aware of
namespaces.
use const instead :
const int VALUE = 50;
--
Matthieu