Use conditional compilation and macro:
#ifdef _DEBUG #define LOG( x ) debugPrint( x ) #else #define LOG( x ) #endif
Define _DEBUG for the debug build and do not define it for the build build. Now in the release, create each
LOG( blahbhahblah );
will be expanded to an empty line - even the parameters will not be evaluated and will not be included in the emitted code.
You can use any pre-processor symbol that is already defined in the debug assembly and not defined in the version instead of _DEBUG .
source share