I saw this debug print for c++ here on stackoverflow but I can't comment it (I'm a newbie):
#ifdef DEBUG
#define dout cout
#else
#define dout 0 && cout
#endif
It is used like this:
dout << "in foobar with x= " << x << " and y= " << y << '\n';
At first sight I liked it, but I compile with -Wall, so I get a lot of warnings like
test1.cc:30:46: warning: statement has no effect [-Wunused-value]
Is there a way to reconcile -Wall and the stream oriented debug print?
This can be further refined, but try this as starting point:
Then later in the code: