They aren’t the same thing so the comparison is weird.
endlhas aflushwhich is important when doing something like embedded work or RTOS development. If i was doing multiple lines they all were\nuntil 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
Several. Probably dozens
Sometimes you work in a codebase that was decided on by others for reasons you don’t know.
\n, because I ordered a newline, not a flush.
#define endl “\n”
What the heck is endl???
Boy am I glad I don’t do C++ anymore. That string handling with the overloaded bitshift operator was wild.
Ah, so you’re a println! kinda guy?
🦀 🦀🦀🦀🦀🦀🦀🦀
Alternatively:
https://en.cppreference.com/w/cpp/io/manip/endl
p.s. The site isn’t entirely mobile friendly
(I’m a cppref lover tbh)
Instead of this:
std::cout << "Hello world.\n";You can do this:
std::cout << "Hello world." << endl;The fact that you used the namespace for
coutbut not forendlinordinately bothers mesomething has replaced your lessthan signs with their HTML counterparts. such a silly thing to do in a code block
I think that’s client side. Doesn’t happen for me.
same here. AP isn’t standardized enough, apparently
nah its a lemmy app on android that didn’t get an update in ages. probably just uses a faulty markdown renderer
From memory it’s a way to declare a line ending after your string.
God bless your soul.
os.linesepLol jk none of my stuff runs on Windows anyway
Environment.NewLine()\r\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.
Environment.NewLine might exist in C#
Microsoft really creating the problem and then forcing you to use their solution.
Rebel side
\0Well, Java has System.lineSeparator so, maybe no?
vbCrLfEndl is faster to type














