Why I'm still using std::cout
As a side note, could you also explain why std::cout has so much hate?
As a side note, could you also explain why
std::couthas so much hate?
Because it is buffered output and, more importantly it is usually used in conjunction with std::endl which flushes the buffer resulting in a very slow operation.
Sorry if this was not the place to reply, just trying to contribute, though I'm terribly curious to know why lefticus still uses std::cout! :) :)
Additionally, the default configuration makes it very slow, which surprises people coming from "slower" languages that can output to stdout faster by default: https://en.cppreference.com/w/cpp/io/ios_base/sync_with_stdio
is that about std::cout over std::print or?
std::print sadly is rather slow, so for short messages i go with std::cout, if i need formatting then really just good old concatenation. And i still dislike std::cout so sometimes it is just printf (hey - if it works... that is not for production-code)
As a side note, could you also explain why
std::couthas so much hate?Because it is buffered output and, more importantly it is usually used in conjunction with
std::endlwhich flushes the buffer resulting in a very slow operation.
Both those things are just configurable default behaviours. And both of them have very valid reason for being so. It is just rather unintuitive for newcomers and global state is (also for good reasons) fround upon.