header image
C++ Marco Debug Options
January 26th, 2012 under Programming. [ Comments: none ]

To be honest, it should be straight forward but I took me a while to figure it out.

I wanted to mark certain lines in the code such that I can easily enable/disable it. So here it is:

// set to 1 to enable timing and output
#if 0
   #define TIMING
   #define OUTPUT
#else
   #define TIMING / ## /
   #define OUTPUT / ## /
#endif
...
   TIMING startTimer();
   ...
   TIMING stopTimer();
...

when #define TIMING / ## / is used then TIMING is replaced with //. Thus the entire line is commented and therefore disabled. This way i can easily turn on/off several debugging facilities.

The ## in the macro definition means that the previous and successive pieces of text are concatenated. So TIMING myCode; results in // myCode;. We cannot use #define TIMING // because the // won’t be parsed as the replacement string, it will be parsed as the comment literal.

This is a simple but handy technique.


C++ Map
January 17th, 2012 under Programming. [ Comments: none ]

Amazing work that shows C++ features and evolution of C++



The Spirit of XMas
November 28th, 2011 under This And That. [ Comments: none ]

This just puts me in the calming Christmas mood ;)

Happy advent


Well….
September 12th, 2011 under This And That. [ Comments: none ]

Have a look at the guy in the background… Enough said :D

(c) de.wikipedia.ch


Just couple of videos I still want to watch
September 7th, 2011 under Programming, This And That. [ Comments: none ]


« Previous entries