Hellfire103@lemmy.ca to Programmer Humor@lemmy.mlEnglish · 14 days agoDoes this exist anywhere outside of C++?external-linkmessage-square23fedilinkarrow-up1118arrow-down16
arrow-up1112arrow-down1external-linkDoes this exist anywhere outside of C++?Hellfire103@lemmy.ca to Programmer Humor@lemmy.mlEnglish · 14 days agomessage-square23fedilink
minus-squareunlawfulbooger@lemmy.blahaj.zonelinkfedilinkarrow-up15·14 days agoWhat the heck is endl???
minus-squarevapeloki@lemmy.worldlinkfedilinkarrow-up30·14 days 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-squareHellfire103@lemmy.caOPlinkfedilinkEnglisharrow-up11·edit-214 days agoInstead of this: cout << "Hello world.\n"; You can do this: cout << "Hello world." << endl;
minus-squareDaedskin@lemm.eelinkfedilinkarrow-up6·13 days agoThe fact that you used the namespace for cout but not for endl inordinately bothers me
minus-squaregon [he]@lemm.eelinkfedilinkEnglisharrow-up5·14 days agohttps://cplusplus.com/reference/ostream/endl/
minus-squareunlawfulbooger@lemmy.blahaj.zonelinkfedilinkarrow-up5arrow-down1·14 days agoBoy am I glad I don’t do C++ anymore. That string handling with the overloaded bitshift operator was wild.
minus-squareSqueakyBeaver@lemmy.blahaj.zonelinkfedilinkarrow-up2·13 days 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-squareallywilson@lemmy.mllinkfedilinkarrow-up3·14 days agoFrom memory it’s a way to declare a line ending after your string.
What the heck is endl???
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 preferredInstead of this:
You can do this:
The fact that you used the namespace for
cout
but not forendl
inordinately bothers mehttps://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.
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)
From memory it’s a way to declare a line ending after your string.
God bless your soul.