This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++17 status.
Section: 31.5.2.2.6[ios.init]Status:C++17Submitter: Richard SmithOpened: 2016-08-13Last modified: 2021-06-06
Priority:0
View all otherissues in [ios.init].
View all issues withC++17 status.
Discussion:
1123(i) fixed a bug where users of<iostream> were not guaranteed to have their streams flushedon program shutdown. However, it also added this rule:
"Similarly, the entire program shall behave as if there were at least one instance of
ios_base::Initwith staticlifetime."
This seems pointless: it only affects the behavior of programs that never include<iostream> (because programsthat do include it are already guaranteed at least one such instance), and those programs do not need an implicit flushbecause they cannot have written to the relevant streams.
[2016-09-09 Issues Resolution Telecon]
P0; move to Tentatively Ready
Proposed resolution:
This wording is relative to N4606.
Modify [ios::Init] p3 as indicated:
-3- The objects are constructed and the associations are established at some time prior to or during the firsttime an object of class
ios_base::Initis constructed, and in any case before the body ofmainbeginsexecution.(footnote 293) The objects are not destroyed during program execution.(footnote 294) The results of including<iostream>in a translation unit shall be as if<iostream>defined an instance ofios_base::Initwith static storage duration.Similarly, the entire program shall behave as if there were atleast one instance ofios_base::Initwith static storage duration.