• @[email protected]
    link
    fedilink
    403 days ago

    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

    • xigoi
      link
      fedilink
      English
      33 days ago

      Don’t most terminals flush the buffer on newline anyway?

      • @[email protected]
        link
        fedilink
        83 days ago

        It is the stream itself that is buffered, so the terminal does not handle the contents until the stream is flushed.