Hellfire103 to Programmer [email protected]English • 3 days agoDoes this exist anywhere outside of C++?lemmy.caimagemessage-square60fedilinkarrow-up1167
arrow-up1167imageDoes this exist anywhere outside of C++?lemmy.caHellfire103 to Programmer [email protected]English • 3 days agomessage-square60fedilink
minus-square@[email protected]linkfedilink40•3 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-squarexigoilinkfedilinkEnglish3•3 days agoDon’t most terminals flush the buffer on newline anyway?
minus-square@[email protected]linkfedilink8•3 days 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 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