Skip to content

Commit ba7675a

Browse files
committed
New issue from S. B. Tam: "§[ios.base.cons] ios_base members may not have indeterminate values after construction"
1 parent 935970b commit ba7675a

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

xml/issue4192.xml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4192" status="New">
5+
<title>&sect;[ios.base.cons] `ios_base` members may not have indeterminate values after construction</title>
6+
<section><sref ref="[ios.base.cons]"/><sref ref="[ios.base.locales]"/></section>
7+
<submitter>S. B. Tam</submitter>
8+
<date>12 Jan 2025</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
<sref ref="[ios.base.cons]"/> specifies that
14+
</p>
15+
<blockquote style="border-left: 3px solid #ccc;padding-left: 15px;">
16+
<p>
17+
Each `ios_base` member has an indeterminate value after construction.
18+
</p>
19+
</blockquote>
20+
<p>
21+
However
22+
</p>
23+
<ul>
24+
<li><p>If the `ios_base` object has static storage duration, the members would have been zero-initialized.</p></li>
25+
<li><p>If the `ios_base` object has automatic storage duration, the members would have erroneous values.</p></li>
26+
</ul>
27+
<p>
28+
In either case, the constructor cannot cause the members to have indeterminate values after construction.
29+
<p/>
30+
A related problem is that <sref ref="[ios.base.locales]"/> requires `ios_base::getloc` to return:
31+
</p>
32+
<blockquote style="border-left: 3px solid #ccc;padding-left: 15px;">
33+
<p>
34+
If no locale has been imbued, a copy of the global C++ locale, `locale()`, in effect at the time of construction.
35+
</p>
36+
</blockquote>
37+
<p>
38+
However, according to <sref ref="[ios.base.cons]"/>, the corresponding member is not initialized
39+
until `basic_ios::init` is called.
40+
</p>
41+
</discussion>
42+
43+
<resolution>
44+
<p>
45+
This wording is relative to <paper num="N5001"/>.
46+
</p>
47+
48+
<ol>
49+
50+
<li><p>Modify <sref ref="[ios.base.locales]"/> as indicated:</p>
51+
52+
<blockquote>
53+
<pre>
54+
ios_base();
55+
</pre>
56+
<blockquote><p>
57+
-1- <i>Effects</i>: Each `ios_base` member has an <ins>unspecified (possibly</ins> indeterminate <ins>or erroneous)</ins>
58+
value after construction. The object's members shall be initialized by calling `basic_ios::init` before the object's
59+
first use or before it is destroyed, whichever comes first; otherwise the behavior is undefined.
60+
</p></blockquote>
61+
</blockquote>
62+
</li>
63+
64+
<li><p>Modify <sref ref="[ios.base.cons]"/> as indicated:</p>
65+
66+
<blockquote>
67+
<pre>
68+
locale getloc() const;
69+
</pre>
70+
<blockquote><p>
71+
-4- <i>Returns</i>: If no locale has been imbued, a copy of the global C++ locale, `locale()`,
72+
in effect at the time of <del>construction</del><ins>the last `basic_ios::init` call on the current
73+
object</ins>. Otherwise, returns the imbued locale, to be used to perform locale-dependent
74+
input and output operations.
75+
</p></blockquote>
76+
</blockquote>
77+
</li>
78+
</ol>
79+
80+
</resolution>
81+
82+
</issue>

0 commit comments

Comments
 (0)