Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++17 status.

2765. Did LWG 1123 go too far?

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 ofios_base::Init with 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.

It's also actively harmful, because it requires the iostreams component to be linked into programs that do not use it,apparently even including freestanding implementations! Fortunately, C++ implementations appear to uniformly ignore this rule.

Can it be removed?

[2016-09-09 Issues Resolution Telecon]

P0; move to Tentatively Ready

Proposed resolution:

This wording is relative to N4606.

  1. 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 classios_base::Init is constructed, and in any case before the body ofmain beginsexecution.(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::Init with static storage duration.Similarly, the entire program shall behave as if there were atleast one instance ofios_base::Init with static storage duration.


[8]ページ先頭

©2009-2026 Movatter.jp