Monthly Archives: June 2008

A Syntax First

I’ve seen a lot of C and C++ source-code in my career.

I’ve never seen anyone write a do while loop without using curly braces. Until now:

do cin.ignore(1024); while (cin.gcount() == 1024);

It’s one of those unconscious things, I guess. If you asked me if you could write it that way, I would have supposed so.

I don’t mean any criticism: it’s fine. It’s clear. Just amused (at myself) that I’ve never seen it.