   preprocessor statements
  Im currently implementing a profiler.Would you guys say it is harmfull doing something like this considering the ugliness of #ifdef:void somefunc(){#ifdef PROFILER_ACTIVEmy profiler code here#endif...}   
  What's ugly is putting ifdefs everywhere you have profiler code. It'll ugly your code, so you may want to move the ifdefs somewhere more central. I'm not sure how this is typically done these days, but this would be a great use case for AOP (aspect-oriented programming).   ;  ick.You could clean that up by doing the following//in your profiler.h#ifdef USING_MY_PROFILER#define ProfileSample(f)MyProfilerSample(f)#else#define ProfileSample(f)#endif//in your other code#include "profiler.h"void some_function (){   ProfileSameple(__FUNCTION__);   ...   ...}that would keep #ifdef's from being everywhere   ;Quote:Original post by KulSeranick.You could clean that up by doing the following*** Source Snippet Removed ***that would keep #ifdef's from being everywhereick.A preprocessor definition that isn't ALL_CAPS_WITH_UNDERSCORES?  Evil.  Apart from that your solution is good though.  I use PP_PROFILE as my #define symbol, so my code looks like:void function_i_want_to_profile(){PP_PROFILE;// code}// profiling source code#define PP_PROFILE Profile local_profile_object(__FUNCTION__)Σnigma   