Disappear debug code in release code C++ -
this question has answer here:
- debug macros in c++ 9 answers
my basic aim, heading suggests, debug code removed in release code, when expending before compilation. now, using _debug
(or custom name) macro guard debug line works fine.
but, don't want write per-processor guard every function / operation call writing in c++ debug file.
edit: response, if can create macro function guards while expending :
dbg_print(fname,msg)\ #ifdef _debug\ fprintf(fname, msg)\ #endif
.
please suggest me clean , single liner way-out.
thanks , happy coding
pre processor instruction way it, can clean code , avoid ifdef debug put everywhere in code if wrap debug calls in common method has body ifdefined, there isn't way without macro or preprocessor checks.
Comments
Post a Comment