3 ms·
Also interesting to note is that as opposed to std::cout; std::cerr (associated with stderr) is automatically flushed, and that std::clog (also associated with
by pveierland 11y ago
Also interesting to note is that as opposed to std::cout; std::cerr (associated with stderr) is automatically flushed, and that std::clog (also associated with stderr) is not automatically flushed.
http://en.cppreference.com/w/cpp/io/clog http://en.cppreference.com/w/cpp/io/clog
- bostonpete 11y agoI guess it's fitting that something called "clog" does not automatically flush. :-)
- kbsletten 11y agoI believe the logic is that error handling (std::cerr) is optimized for being immediate because you need to see that last error message before your program went off the rails. Logging (std::clog) on the other hand is optimized for throughput since you expect to use some of that even in the happy path and don't want to bog everything down. I believe that since they're both associated with stderr, the error handling routine will also flush the last of the log.