C++ How to produce legal and non-existent code

Why would anybody do this? What is “non-existent” code?  That is the code that compiles into zero bytes. It is non-existent in the resulting executable. So, in C++, how to make temporarily unwanted code legal (so we know it compiles); but non-existent?

You might want it back sometime shortly.  Well, that is simple, say you, there is this well-known, mature and universally used macro that does make unused code “get out of the way”

// de-facto C/C++ standard
#define UNUSED(x) (void)x

If this macro makes you ask questions please read on, otherwise, leave in peace. Continue reading


Simplicity is a great virtue but it requires hard work to achieve it and education to appreciate it. And to make matters worse: complexity sells better.” — Edsger Dijkstra