This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.

333. does endl imply synchronization with the device?

Section: [ostream.manip] Status: CD1 Submitter: PremAnand M. Rao Opened: 2001-08-27 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [ostream.manip].

View all issues with CD1 status.


A footnote in [ostream.manip] states:

[Footnote: The effect of executing cout << endl is to insert a newline character in the output sequence controlled by cout, then synchronize it with any external file with which it might be associated. --- end foonote]

Does the term "file" here refer to the external device? This leads to some implementation ambiguity on systems with fully buffered files where a newline does not cause a flush to the device.

Choosing to sync with the device leads to significant performance penalties for each call to endl, while not sync-ing leads to errors under special circumstances.

I could not find any other statement that explicitly defined the behavior one way or the other.

Proposed resolution:

Remove footnote 300 from section [ostream.manip].


We already have normative text saying what endl does: it inserts a newline character and calls flush. This footnote is at best redundant, at worst (as this issue says) misleading, because it appears to make promises about what flush does.