Hellfire103 to Programmer [email protected]English • 3 months agoDoes this exist anywhere outside of C++?lemmy.mlimagemessage-square64fedilinkarrow-up1175cross-posted to: [email protected]
arrow-up1175imageDoes this exist anywhere outside of C++?lemmy.mlHellfire103 to Programmer [email protected]English • 3 months agomessage-square64fedilinkcross-posted to: [email protected]
minus-square@[email protected]linkfedilink3•3 months agoFrom memory it’s a way to declare a line ending after your string.
minus-square@[email protected]linkfedilink40•3 months agostd::endl is used in output streams in C++ to end the line, using the os specific line termination sequence, and flush the buffer. The later one is a performance issue in many cases, why the use of "\n" is considered preferred
minus-squarexigoilinkfedilinkEnglish3•3 months agoDon’t most terminals flush the buffer on newline anyway?
minus-square@[email protected]linkfedilink9•3 months agoIt is the stream itself that is buffered, so the terminal does not handle the contents until the stream is flushed.
minus-square@[email protected]linkfedilink2•3 months agoMaybe, but there is the internal buffer. Also, most I/O happens in files not consoles
minus-square@[email protected]linkfedilink12•3 months agoBoy am I glad I don’t do C++ anymore. That string handling with the overloaded bitshift operator was wild.
minus-square@[email protected]linkfedilink2•3 months agoAlternatively: https://en.cppreference.com/w/cpp/io/manip/endl p.s. The site isn’t entirely mobile friendly (I’m a cppref lover tbh)
minus-squareHellfire103OPlinkfedilinkEnglish10•edit-23 months agoInstead of this: std::cout << "Hello world.\n"; You can do this: std::cout << "Hello world." << endl;
minus-square@[email protected]linkfedilinkEnglish1•3 months agosomething has replaced your lessthan signs with their HTML counterparts. such a silly thing to do in a code block
minus-square@[email protected]linkfedilinkEnglish3•3 months agoI think that’s client side. Doesn’t happen for me.
minus-square@[email protected]linkfedilinkEnglish1•3 months agosame here. AP isn’t standardized enough, apparently
minus-square@[email protected]linkfedilinkEnglish1•edit-23 months agonah its a lemmy app on android that didn’t get an update in ages. probably just uses a faulty markdown renderer
minus-square@[email protected]linkfedilink6•3 months agoThe fact that you used the namespace for cout but not for endl inordinately bothers me
What the heck is endl???
From memory it’s a way to declare a line ending after your string.
std::endl
is used in output streams in C++ to end the line, using the os specific line termination sequence, and flush the buffer.The later one is a performance issue in many cases, why the use of
"\n"
is considered preferredDon’t most terminals flush the buffer on newline anyway?
It is the stream itself that is buffered, so the terminal does not handle the contents until the stream is flushed.
Maybe, but there is the internal buffer. Also, most I/O happens in files not consoles
https://cplusplus.com/reference/ostream/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)
God bless your soul.
Instead of this:
You can do this:
something 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
The fact that you used the namespace for
cout
but not forendl
inordinately bothers me