c++ - How do I turn off functions that are used to print debug data in the program -


so there several functions in c++ program "dump" data. has immensly helped me troubleshoot developed application. data dumped dozen ascii files.

now want these functions not dump data can see how fast program can run , also, have "final version" of program.

do functions:

#define do_debug #ifdef do_debug void dump_dataa(...) {     // lot of code } #else void dump_dataa(...) {     return; } #endif 

i thinking along these lines since cannot go , remove lines dump data onto std::out , ascii files. not seem idea. since if have upgrade program later, lines me. best way "turn off" functions dumping debug data?

your way possible, arguments evaluated, , implementation should visible (in header). may use preprocessor follow:

#define do_debug  #ifdef do_debug void dump_dataa_impl(/*args*/); // implement in cpp file or in header  # define dump_dataa(...) dump_dataa_impl(__va_args__)  #else # define dump_dataa(...) /* empty */ #endif 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -