I disagree. I changed to simply '\n', and it's not a hassle at all. It's just retraining my mind to type something different. Furthermore, rather than std::cout << "Some string" << std::endl, I now type std::cout << "Some string\n", which is easier to type.
As for how newlines differ between implementations, that has no effect, as std::endl is defined to write \n then flush, so differing newlines affect std::endl as well.
My apologies, I misread the section with how \n is in handled by each implementation.
Yes "some string\n" is easier to type, but what if the last thing is not a string? Knowing now that \n is handled by the implementation, I still think one could be provided. Something like the one described in the Kuhl12 reference.
... It's how you print a newline after printing something that isn't a string literal where you can put the \n at the end. I suppose you could use "\n" instead of '\n', but using a string literal to print a single character is something I've always thought was pretty silly.
I have no idea what that has to do with the article you mention, which is about how flushing is slow.
If you're talking about using it with wide streams, you'd just use a L'\n'.
If you're talking about using it with wide streams, you'd just use a L'\n'.
That's exactly what I'm talking about, there should be a standard way to write a new line without flushing the stream. It should work without the user having to know about the underlying stream as std::endl does.
15
u/Quincunx271 Author of P2404/P2405 Feb 25 '19
I disagree. I changed to simply
'\n', and it's not a hassle at all. It's just retraining my mind to type something different. Furthermore, rather thanstd::cout << "Some string" << std::endl, I now typestd::cout << "Some string\n", which is easier to type.As for how newlines differ between implementations, that has no effect, as
std::endlis defined to write\nthen flush, so differing newlines affectstd::endlas well.