Hey.
I want to do this:But I only want the LOG macro to work if USE_LOG is defined... in other words, if USE_LOG isn't defined, the LOG macro won't do anything. I'm trying to write the macro for this but I can't get it right:Code:void f() { LOG("Called f()."); }This gives me a warning:Code:#ifndef LOG(string) #define LOG(string) #ifdef USE_LOG Logger::Get().Log(string) #endif #endifAlso I'm just not sure if it will do what I think it will do... if USE_LOG isn't defined and the call "disappears" everywhere it is used in code, will it leave behind semicolons everywhere? If so, is this a bad thing? Will the compiler interpret these as statements and spend time processing them?Code:warning C4067: unexpected tokens following preprocessor directive - expected a newline c:\...\logger.h
Cheers.




Reply With Quote