C trigraphs. WTF.

I added a “loud” but seemingly innocuous print statement to debug a C++ program:

cout << "WAITING!?!?!?!??!" << endl;

On compilation, I got:

$ g++ -Wall -c -o main.o main.cc
In file included from main.lzz:12,
                 from main.cc:4:
warning: trigraph ??! ignored, use -trigraphs to enable

Turns out I used just the right combo of ?? and ! in my program. I had run into C trigraphs (gcc documentation).

Follow me on Twitter for stuff far more interesting than what I blog.