D
Dave O'Hearn
Adam said:I also tend to send debugging information to std::cerr instead
of std::cout. It makes it easier to debug filters, and (correct
me if I'm wrong) std::cerr isn't buffered. (OTOH, I generally
use std::endl with std::cerr anyway, so it wouldn't bite me if
it were.)
Correct, std::cerr isn't buffered. You may want to consider std::clog
instead, though. It writes to the same destination as std::cerr, but is
buffered. Using it properly can lead to many fewer flush operations
than using std::cerr, but you do have to remember to flush at the end
of every line. This is easy if you use a wrapper around the stream
though; I have one that inserts timestamps and flushes at the end of a
line.