Hellfire103@lemmy.ca to Programmer Humor@lemmy.mlEnglish · 2 天前Does this exist anywhere outside of C++?lemmy.mlimagemessage-square59fedilinkarrow-up1167arrow-down18cross-posted to: [email protected]
arrow-up1159arrow-down1imageDoes this exist anywhere outside of C++?lemmy.mlHellfire103@lemmy.ca to Programmer Humor@lemmy.mlEnglish · 2 天前message-square59fedilinkcross-posted to: [email protected]
minus-squareallywilson@lemmy.mllinkfedilinkarrow-up3·2 天前From memory it’s a way to declare a line ending after your string.
minus-squarevapeloki@lemmy.worldlinkfedilinkarrow-up40·2 天前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 preferred
minus-squarexigoi@lemmy.sdf.orglinkfedilinkEnglisharrow-up3arrow-down1·2 天前Don’t most terminals flush the buffer on newline anyway?
minus-squareClemaX@lemm.eelinkfedilinkarrow-up8arrow-down1·2 天前It is the stream itself that is buffered, so the terminal does not handle the contents until the stream is flushed.
minus-squarevapeloki@lemmy.worldlinkfedilinkarrow-up2·2 天前Maybe, but there is the internal buffer. Also, most I/O happens in files not consoles
minus-squareHellfire103@lemmy.caOPlinkfedilinkEnglisharrow-up10·edit-22 天前Instead of this: cout << "Hello world.\n"; You can do this: cout << "Hello world." << endl;
minus-squareReversalHatchery@beehaw.orglinkfedilinkEnglisharrow-up1·2 天前something has replaced your lessthan signs with their HTML counterparts. such a silly thing to do in a code block
minus-squarefubbernuckin@lemmy.dbzer0.comlinkfedilinkEnglisharrow-up3·2 天前I think that’s client side. Doesn’t happen for me.
minus-squareCyberfishofant2@lemm.eelinkfedilinkEnglisharrow-up1·1 天前same here. AP isn’t standardized enough, apparently
minus-squareReversalHatchery@beehaw.orglinkfedilinkEnglisharrow-up1·edit-220 小时前nah its a lemmy app on android that didn’t get an update in ages. probably just uses a faulty markdown renderer
minus-squareDaedskin@lemm.eelinkfedilinkarrow-up5·20 小时前The fact that you used the namespace for cout but not for endl inordinately bothers me
minus-squaregon [he]@lemm.eelinkfedilinkEnglisharrow-up7·2 天前https://cplusplus.com/reference/ostream/endl/
minus-squareSqueakyBeaver@lemmy.blahaj.zonelinkfedilinkarrow-up2·23 小时前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)
minus-squareunlawfulbooger@lemmy.blahaj.zonelinkfedilinkarrow-up12arrow-down1·2 天前Boy am I glad I don’t do C++ anymore. That string handling with the overloaded bitshift operator was wild.
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
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 mehttps://cplusplus.com/reference/ostream/endl/
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)
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?
🦀 🦀🦀🦀🦀🦀🦀🦀
God bless your soul.