This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Namespaces and pre-processing directives


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]