#define syntax for create a class instance
-
Hi, Is it possible to create a macro that would create an instance of a class? I'm trying this but the compiler won't accept it: #define Logger() (MyLogger tempLogger(__FUNCTION__, __FILE__, __LINE__)) Thanks Hua-Ying
-
Hi, Is it possible to create a macro that would create an instance of a class? I'm trying this but the compiler won't accept it: #define Logger() (MyLogger tempLogger(__FUNCTION__, __FILE__, __LINE__)) Thanks Hua-Ying
class MyLogger { MyLogger( char*, char*, char*) { } }; #define Logger() (MyLogger tempLogger(__FUNCTION__, __FILE__, __LINE__)) no error on visual c++ 6.0... NG
-
-
class MyLogger { MyLogger( char*, char*, char*) { } }; #define Logger() (MyLogger tempLogger(__FUNCTION__, __FILE__, __LINE__)) no error on visual c++ 6.0... NG
The syntax error only occurs when I try to use the macro. The errors are: error C2059: syntax error : ')' error C2146: syntax error : missing ')' before identifier 'tempLogger' error C3861: 'tempLogger': identifier not found, even with argument-dependent lookup Hua-Ying
-
The syntax error only occurs when I try to use the macro. The errors are: error C2059: syntax error : ')' error C2146: syntax error : missing ')' before identifier 'tempLogger' error C3861: 'tempLogger': identifier not found, even with argument-dependent lookup Hua-Ying
-
#include using namespace std; #define Logger() MyLogger tempLogger(__FUNCTION__, __FILE__, __LINE__) class MyLogger { public: MyLogger(char *pFunction, char *pFile, long Line) { cout<