#define statements within a namespace

Correct,#define‘s aren’t bound by namespaces. #define is a preprocessor directive – it results in manipulation of the source file prior to being compiled via the compiler. Namespaces are used during the compilation step and the compiler has no insight into the #define‘s.

You should try to avoid the preprocessor as much as possible. For constant values like this, prefer const over #define‘s.

Leave a Comment