W
wenmang
Hi, all:
I have a question regarding to how to solve following problem:
I have header called myHeader.h which #define MAX_LEN 100 (legacy
code).
Now, I like to put most commonly used in myHeader.h into a namespace,
e.g.,
#include <myHeader.h>
namespace myNamespace
{
const int MAX_LEN = 100;
MyData data[MAX_NUM]; //MyData defined in myHeader.h
};
Unfortunately, I have to include myHeader.h and compiler fails me due
to that MAX_LEN is probably replaced with 100 by preprocessor since it
complains about syntax error, what is best way to solve this?
thx
I have a question regarding to how to solve following problem:
I have header called myHeader.h which #define MAX_LEN 100 (legacy
code).
Now, I like to put most commonly used in myHeader.h into a namespace,
e.g.,
#include <myHeader.h>
namespace myNamespace
{
const int MAX_LEN = 100;
MyData data[MAX_NUM]; //MyData defined in myHeader.h
};
Unfortunately, I have to include myHeader.h and compiler fails me due
to that MAX_LEN is probably replaced with 100 by preprocessor since it
complains about syntax error, what is best way to solve this?
thx