A
Allen
Last time, i post a topic about inline class member declaration in C++.
And in VC6, it does not support inline class member.
Now I upgrade to VC 2005. But the compiler doesnot completely support
it.
// Logger.h
class CLogger
{
public:
static const int nameLen = 16;
};
// FileLogger.cpp
#include "Logger.h"
void CFileLogger::Write()
{
char szBuf[CLogger::nameLen];
...
}
// DnetLogger.cpp
#include "Logger.h"
void CDnetLogger::Write()
{
char szBuf[CLogger::nameLen];
...
}
As shown above, CLogger::nameLen was used in serval cpp files.
I am confused by vc 2005 that one of the cpp files failed to compile.
It says that CLogger::nameLen is illegal, syntax error.
Why?
And in VC6, it does not support inline class member.
Now I upgrade to VC 2005. But the compiler doesnot completely support
it.
// Logger.h
class CLogger
{
public:
static const int nameLen = 16;
};
// FileLogger.cpp
#include "Logger.h"
void CFileLogger::Write()
{
char szBuf[CLogger::nameLen];
...
}
// DnetLogger.cpp
#include "Logger.h"
void CDnetLogger::Write()
{
char szBuf[CLogger::nameLen];
...
}
As shown above, CLogger::nameLen was used in serval cpp files.
I am confused by vc 2005 that one of the cpp files failed to compile.
It says that CLogger::nameLen is illegal, syntax error.
Why?