Original Post
Im looking for a simple ( or not so simple, either will do ) solution to the following.
Currently in debug i have a function define for logging output
Now to use this i have to wrap it up like so:
#ifdef _DEBUG
Log("harrow world");
#endif
Just wondering if there is a way to just call: Log() and the compiler would know to skip this in a release build? Im using VS2008 if theres a clever trick for that. I plan to extend it into a class later so not having the class initialised in release would be beneficial too.
I know its being completely anal but i hate duplicating that over and over. Am i right to assume that some compilers if they see a function body is empty they will remove the function call completely? I don't really want to rely on the compiler for this though.
Currently in debug i have a function define for logging output
#ifdef _DEBUGvoid Log(const char *pText){ printf(pText);#ifdef _WINDOWS.... // and a fair few others}#endifNow to use this i have to wrap it up like so:
#ifdef _DEBUG
Log("harrow world");
#endif
Just wondering if there is a way to just call: Log() and the compiler would know to skip this in a release build? Im using VS2008 if theres a clever trick for that. I plan to extend it into a class later so not having the class initialised in release would be beneficial too.
I know its being completely anal but i hate duplicating that over and over. Am i right to assume that some compilers if they see a function body is empty they will remove the function call completely? I don't really want to rely on the compiler for this though.