Namespaces and pre-processing directives

Matthieu Moy Matthieu.Moy@imag.fr
Fri Apr 4 10:42:00 GMT 2003


"Megha Murarka" <megha@poseidontech.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



More information about the Gcc-help mailing list