Skip to content

Commit 5015be0

Browse files
committed
New issue from Jan Schultke: "Clarify the output encoding of to_chars for integers"
1 parent 47ad266 commit 5015be0

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

xml/issue4421.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4421" status="New">
5+
<title>Clarify the output encoding of `to_chars` for integers</title>
6+
<section><sref ref="[charconv.to.chars]"/></section>
7+
<submitter>Jan Schultke</submitter>
8+
<date>17 Oct 2025</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
The integer overload of `to_chars` is specified "manually" rather than in terms of `printf`,
14+
and it is not clearly stated what encoding the output characters have. Given the existing
15+
use of the character literal `'-'` in the <i>Effects</i> element, the intent is presumably
16+
to output in the ordinary literal encoding.
17+
</p>
18+
</discussion>
19+
20+
<resolution>
21+
<p>
22+
This wording is relative to <paper num="N5014"/>.
23+
</p>
24+
25+
<ol>
26+
27+
<li><p>Modify <sref ref="[charconv.to.chars]"/> as indicated:</p>
28+
29+
<blockquote>
30+
<pre>
31+
constexpr to_chars_result to_chars(char* first, char* last, <i>integer-type</i> value, int base = 10);
32+
</pre>
33+
<blockquote>
34+
<p>
35+
-4- <i>Preconditions</i>: `base` has a value between 2 and 36 (inclusive).
36+
<p/>
37+
-5- <i>Effects</i>: The value of `value` is converted to a string of digits in the given base (with no redundant
38+
leading zeroes) <ins>in the ordinary literal encoding (<sref ref="[lex.charset]"/>)</ins>. Digits in the range
39+
10..35 (inclusive) are represented as lowercase characters <tt><ins>'</ins>a<ins>'</ins>..<ins>'</ins>z<ins>'</ins></tt>. If
40+
`value` is less than zero, the representation starts with `'-'`.
41+
</p>
42+
</blockquote>
43+
</blockquote>
44+
</li>
45+
</ol>
46+
47+
</resolution>
48+
49+
</issue>

0 commit comments

Comments
 (0)