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]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]linkfedilink2•3 months agoMaybe, but there is the internal buffer. Also, most I/O happens in files not consoles
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.
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?
Maybe, but there is the internal buffer. Also, most I/O happens in files not consoles
It is the stream itself that is buffered, so the terminal does not handle the contents until the stream is flushed.