Endl is faster to type
Programmer Humor
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
They aren't the same thing so the comparison is weird.
endl
has a flush
which is important when doing something like embedded work or RTOS development. If i was doing multiple lines they all were \n
until the last line when i actually want to push the buffer.
Obviously depending on the tuning of the compiler's optimization multiple flushes could be reduced but the goal should always be to write as optimal as possible.
but the goal should always be to write as optimal as possible.
Within reason.
Over optimization is a curse on getting done.
Who in the hell is using iostreams in an RTOS
Sometimes you work in a codebase that was decided on by others for reasons you don't know.
Several. Probably dozens
\n, because I ordered a newline, not a flush.
Environment.NewLine might exist in C#
Microsoft really creating the problem and then forcing you to use their solution.
It might do. I encountered it last week as I needed it for a powershell script. So it exists in that at least
vbCrLf
#define endl "\n"
If you write to a text (as opposed to binary) stream, \n produces \n or \r\n (or \r if old enough) depending on platform just fine.
Nobody should be using C++ anyway, but plenty of languages have silly system newline constants, which do nothing useful.
Why should no one be using c++?
Rebel side \0
os.linesep
Lol jk none of my stuff runs on Windows anyway
\r\n
I'm on side \PHP_EOL
I like that you added the absolute namespace identifier or whatever its called
I don't always namespace but when I do I fully qualify.