Hellfire103@lemmy.ca to Programmer Humor@lemmy.mlEnglish · 2 days agoDoes 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 days agomessage-square59fedilinkcross-posted to: [email protected]
minus-squarevapeloki@lemmy.worldlinkfedilinkarrow-up40·2 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-squarexigoi@lemmy.sdf.orglinkfedilinkEnglisharrow-up3arrow-down1·2 days agoDon’t most terminals flush the buffer on newline anyway?
minus-squareClemaX@lemm.eelinkfedilinkarrow-up8arrow-down1·2 days agoIt 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 days agoMaybe, but there is the internal buffer. Also, most I/O happens in files not consoles
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