pointed out that
cerr actually write to separate streams, which happen to show up in the same place by default.
There is one other difference that can sometimes be quite significant:
unitbuf is always true for
cerr, which means that anything written to
cerr is flushed after each output operation. By contrast, cout is typically line buffered, or (when directed to a file, fully buffered), though that’s not guaranteed.
There is also a
clog stream, which (like cerr) writes to the standard error stream, but unlike cerr it can be line buffered or fully buffered.