Skip to content

Commit 0545651

Browse files
committed
Update paper
1 parent 45e6272 commit 0545651

File tree

2 files changed

+35
-24
lines changed

2 files changed

+35
-24
lines changed

papers/p3395.bs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<pre class='metadata'>
22
Title: Fix encoding issues and add a formatter for std::error_code
33
Shortname: P3395
4-
Revision: 3
4+
Revision: 4
55
Audience: LEWG
66
Status: P
77
Group: WG21
88
URL:
99
Editor: Victor Zverovich, victor.zverovich@gmail.com
1010
No abstract: true
11-
Date: 2025-03-22
11+
Date: 2025-04-12
1212
Markup Shorthands: markdown yes
1313
</pre>
1414

@@ -32,6 +32,11 @@ This paper proposes making `std::error_code` formattable using the formatting
3232
facility introduced in C++20 (`std::format`) and fixes encoding issues in the
3333
underlying API ([[LWG4156]]).
3434

35+
Changes since R3 {#changes3}
36+
================
37+
38+
- Fixed a typo in the wording.
39+
3540
Changes since R2 {#changes2}
3641
================
3742

papers/p3395.html

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<head>
33
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
44
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
5-
<title>P3395R3: Fix encoding issues and add a formatter for std::error_code</title>
5+
<title>P3395R4: Fix encoding issues and add a formatter for std::error_code</title>
66
<style data-fill-with="stylesheet">/******************************************************************************
77
* Style sheet for the W3C specifications *
88
*
@@ -1563,7 +1563,7 @@
15631563
</style>
15641564
<meta content="Bikeshed version 4416b18d5, updated Tue Jan 2 15:52:39 2024 -0800" name="generator">
15651565
<link href="https://isocpp.org/favicon.ico" rel="icon">
1566-
<meta content="ffa4bbcf62ea6e9cab438f2e0b9a8d68ffa82427" name="revision">
1566+
<meta content="45e6272aa1eec1ebdf0da352b8d044c4db4a59c8" name="revision">
15671567
<style type="text/css">
15681568
td {
15691569
vertical-align: middle;
@@ -2098,8 +2098,8 @@
20982098
<body class="h-entry">
20992099
<div class="head">
21002100
<p data-fill-with="logo"></p>
2101-
<h1 class="p-name no-ref" id="title">P3395R3<br>Fix encoding issues and add a formatter for std::error_code</h1>
2102-
<h2 class="no-num no-toc no-ref heading settled" id="profile-and-date"><span class="content">Published Proposal, <time class="dt-updated" datetime="2025-03-22">2025-03-22</time></span></h2>
2101+
<h1 class="p-name no-ref" id="title">P3395R4<br>Fix encoding issues and add a formatter for std::error_code</h1>
2102+
<h2 class="no-num no-toc no-ref heading settled" id="profile-and-date"><span class="content">Published Proposal, <time class="dt-updated" datetime="2025-04-12">2025-04-12</time></span></h2>
21032103
<div data-fill-with="spec-metadata">
21042104
<dl>
21052105
<dt class="editor">Author:
@@ -2117,15 +2117,16 @@ <h2 class="no-num no-toc no-ref heading settled" id="profile-and-date"><span cla
21172117
<h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
21182118
<ol class="toc" role="directory">
21192119
<li><a href="#intro"><span class="secno">1</span> <span class="content">Introduction</span></a>
2120-
<li><a href="#changes2"><span class="secno">2</span> <span class="content">Changes since R2</span></a>
2121-
<li><a href="#changes1"><span class="secno">3</span> <span class="content">Changes since R1</span></a>
2122-
<li><a href="#changes0"><span class="secno">4</span> <span class="content">Changes since R0</span></a>
2123-
<li><a href="#polls"><span class="secno">5</span> <span class="content">Polls</span></a>
2124-
<li><a href="#motivation"><span class="secno">6</span> <span class="content">Motivation</span></a>
2125-
<li><a href="#proposal"><span class="secno">7</span> <span class="content">Proposal</span></a>
2126-
<li><a href="#previous"><span class="secno">8</span> <span class="content">Previous work</span></a>
2127-
<li><a href="#wording"><span class="secno">9</span> <span class="content">Wording</span></a>
2128-
<li><a href="#impl"><span class="secno">10</span> <span class="content">Implementation</span></a>
2120+
<li><a href="#changes3"><span class="secno">2</span> <span class="content">Changes since R3</span></a>
2121+
<li><a href="#changes2"><span class="secno">3</span> <span class="content">Changes since R2</span></a>
2122+
<li><a href="#changes1"><span class="secno">4</span> <span class="content">Changes since R1</span></a>
2123+
<li><a href="#changes0"><span class="secno">5</span> <span class="content">Changes since R0</span></a>
2124+
<li><a href="#polls"><span class="secno">6</span> <span class="content">Polls</span></a>
2125+
<li><a href="#motivation"><span class="secno">7</span> <span class="content">Motivation</span></a>
2126+
<li><a href="#proposal"><span class="secno">8</span> <span class="content">Proposal</span></a>
2127+
<li><a href="#previous"><span class="secno">9</span> <span class="content">Previous work</span></a>
2128+
<li><a href="#wording"><span class="secno">10</span> <span class="content">Wording</span></a>
2129+
<li><a href="#impl"><span class="secno">11</span> <span class="content">Implementation</span></a>
21292130
<li>
21302131
<a href="#references"><span class="secno"></span> <span class="content">References</span></a>
21312132
<ol class="toc">
@@ -2138,19 +2139,24 @@ <h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </s
21382139
<p>This paper proposes making <code class="highlight"><c- n>std</c-><c- o>::</c-><c- n>error_code</c-></code> formattable using the formatting
21392140
facility introduced in C++20 (<code class="highlight"><c- n>std</c-><c- o>::</c-><c- n>format</c-></code>) and fixes encoding issues in the
21402141
underlying API (<a data-link-type="biblio" href="#biblio-lwg4156" title="`error_category` messages have unspecified encoding">[LWG4156]</a>).</p>
2141-
<h2 class="heading settled" data-level="2" id="changes2"><span class="secno">2. </span><span class="content">Changes since R2</span><a class="self-link" href="#changes2"></a></h2>
2142+
<h2 class="heading settled" data-level="2" id="changes3"><span class="secno">2. </span><span class="content">Changes since R3</span><a class="self-link" href="#changes3"></a></h2>
2143+
<ul>
2144+
<li data-md>
2145+
<p>Fixed a typo in the wording.</p>
2146+
</ul>
2147+
<h2 class="heading settled" data-level="3" id="changes2"><span class="secno">3. </span><span class="content">Changes since R2</span><a class="self-link" href="#changes2"></a></h2>
21422148
<ul>
21432149
<li data-md>
21442150
<p>Added a reference to <a data-link-type="biblio" href="#biblio-p2930" title="Formatter specializations for the standard library">[P2930]</a> and how it differs from the current proposal.</p>
21452151
</ul>
2146-
<h2 class="heading settled" data-level="3" id="changes1"><span class="secno">3. </span><span class="content">Changes since R1</span><a class="self-link" href="#changes1"></a></h2>
2152+
<h2 class="heading settled" data-level="4" id="changes1"><span class="secno">4. </span><span class="content">Changes since R1</span><a class="self-link" href="#changes1"></a></h2>
21472153
<ul>
21482154
<li data-md>
21492155
<p>Added a debug format to avoid ambiguity when formatting error codes in maps.</p>
21502156
<li data-md>
21512157
<p>Added SG16 poll results.</p>
21522158
</ul>
2153-
<h2 class="heading settled" data-level="4" id="changes0"><span class="secno">4. </span><span class="content">Changes since R0</span><a class="self-link" href="#changes0"></a></h2>
2159+
<h2 class="heading settled" data-level="5" id="changes0"><span class="secno">5. </span><span class="content">Changes since R0</span><a class="self-link" href="#changes0"></a></h2>
21542160
<ul>
21552161
<li data-md>
21562162
<p>Changed the title from "Formatting of std::error_code" to "Fix encoding
@@ -2164,7 +2170,7 @@ <h2 class="heading settled" data-level="4" id="changes0"><span class="secno">4.
21642170
literal encoding is not UTF-8 per SG16 feedback and for consistency with
21652171
other similar cases in the standard.</p>
21662172
</ul>
2167-
<h2 class="heading settled" data-level="5" id="polls"><span class="secno">5. </span><span class="content">Polls</span><a class="self-link" href="#polls"></a></h2>
2173+
<h2 class="heading settled" data-level="6" id="polls"><span class="secno">6. </span><span class="content">Polls</span><a class="self-link" href="#polls"></a></h2>
21682174
<p>SG16 poll results for R0:</p>
21692175
<p><strong>Poll 1</strong>: Forward P3395R0 to LEWG amended to specify an encoding for <code class="highlight"><c- n>std</c-><c- o>::</c-><c- n>error_category</c-><c- o>::</c-><c- n>name</c-><c- p>()</c-></code> and for transcoding to be to UTF-8 if that
21702176
matches the ordinary literal encoding and to an implementation-defined encoding
@@ -2173,7 +2179,7 @@ <h2 class="heading settled" data-level="5" id="polls"><span class="secno">5. </s
21732179
1 6 0 0 0
21742180
</pre>
21752181
<p>Outcome: Strong consensus.</p>
2176-
<h2 class="heading settled" data-level="6" id="motivation"><span class="secno">6. </span><span class="content">Motivation</span><a class="self-link" href="#motivation"></a></h2>
2182+
<h2 class="heading settled" data-level="7" id="motivation"><span class="secno">7. </span><span class="content">Motivation</span><a class="self-link" href="#motivation"></a></h2>
21772183
<p><code class="highlight"><c- n>error_code</c-></code> has a rudimentary <code class="highlight"><c- n>ostream</c-></code> inserter. For example:</p>
21782184
<pre class="highlight"><c- n>std</c-><c- o>::</c-><c- n>error_code</c-> <c- n>ec</c-><c- p>;</c->
21792185
<c- k>auto</c-> <c- n>size</c-> <c- o>=</c-> <c- n>std</c-><c- o>::</c-><c- n>filesystem</c-><c- o>::</c-><c- n>file_size</c-><c- p>(</c-><c- s>"nonexistent"</c-><c- p>,</c-> <c- n>ec</c-><c- p>);</c->
@@ -2193,7 +2199,7 @@ <h2 class="heading settled" data-level="6" id="motivation"><span class="secno">6
21932199
</pre>
21942200
<p>Additionally, it doesn’t allow formatting the error message and introduces
21952201
potential encoding issues, as the encoding of the category name is unspecified.</p>
2196-
<h2 class="heading settled" data-level="7" id="proposal"><span class="secno">7. </span><span class="content">Proposal</span><a class="self-link" href="#proposal"></a></h2>
2202+
<h2 class="heading settled" data-level="8" id="proposal"><span class="secno">8. </span><span class="content">Proposal</span><a class="self-link" href="#proposal"></a></h2>
21972203
<p>This paper proposes adding a <code class="highlight"><c- n>formatter</c-></code> specialization for <code class="highlight"><c- n>std</c-><c- o>::</c-><c- n>error_code</c-></code> to address the problems discussed in the previous section.</p>
21982204
<p>The default format will produce the same output as the <code class="highlight"><c- n>ostream</c-></code> inserter:</p>
21992205
<pre class="highlight"><c- n>std</c-><c- o>::</c-><c- n>print</c-><c- p>(</c-><c- s>"{}</c-><c- se>\n</c-><c- s>"</c-><c- p>,</c-> <c- n>ec</c-><c- p>);</c->
@@ -2256,10 +2262,10 @@ <h2 class="heading settled" data-level="7" id="proposal"><span class="secno">7.
22562262
likely need to change anyway. This also resolves <a data-link-type="biblio" href="#biblio-lwg4156" title="`error_category` messages have unspecified encoding">[LWG4156]</a>.</p>
22572263
<p>An alternative approach could involve communicating the encoding from <code class="highlight"><c- n>error_category</c-></code>. However, this introduces ABI challenges and complicates usage
22582264
compared to adopting a single encoding.</p>
2259-
<h2 class="heading settled" data-level="8" id="previous"><span class="secno">8. </span><span class="content">Previous work</span><a class="self-link" href="#previous"></a></h2>
2265+
<h2 class="heading settled" data-level="9" id="previous"><span class="secno">9. </span><span class="content">Previous work</span><a class="self-link" href="#previous"></a></h2>
22602266
<p>A formatter for <code class="highlight"><c- n>std</c-><c- o>::</c-><c- n>error_code</c-></code> was proposed as part of <a data-link-type="biblio" href="#biblio-p2930" title="Formatter specializations for the standard library">[P2930]</a> which
22612267
has more formatting options but doesn’t try to address encoding issues.</p>
2262-
<h2 class="heading settled" data-level="9" id="wording"><span class="secno">9. </span><span class="content">Wording</span><a class="self-link" href="#wording"></a></h2>
2268+
<h2 class="heading settled" data-level="10" id="wording"><span class="secno">10. </span><span class="content">Wording</span><a class="self-link" href="#wording"></a></h2>
22632269
<p>Add to "Header &lt;system_error> synopsis" <a href="https://eel.is/c++draft/system.error.syn">[system.error.syn</a>]:</p>
22642270
<pre class="highlight"><c- c1>// [system.error.fmt], formatter</c->
22652271
<c- k>template</c-><c- o>&lt;</c-><c- k>class</c-> <c- nc>charT</c-><c- o>></c-> <c- k>struct</c-> <c- nc>formatter</c-><c- o>&lt;</c-><c- n>error_code</c-><c- p>,</c-> <c- n>charT</c-><c- o>></c-><c- p>;</c->
@@ -2323,7 +2329,7 @@ <h2 class="heading settled" data-level="9" id="wording"><span class="secno">9. <
23232329
set</ins>
23242330
that describes the error condition denoted by <code class="highlight"><c- n>ev</c-></code>.
23252331
</p>
2326-
<h2 class="heading settled" data-level="10" id="impl"><span class="secno">10. </span><span class="content">Implementation</span><a class="self-link" href="#impl"></a></h2>
2332+
<h2 class="heading settled" data-level="11" id="impl"><span class="secno">11. </span><span class="content">Implementation</span><a class="self-link" href="#impl"></a></h2>
23272333
<p>The proposed <code class="highlight"><c- n>formatter</c-></code> for <code class="highlight"><c- n>std</c-><c- o>::</c-><c- n>error_code</c-></code> has been implemented in the
23282334
open-source {fmt} library (<a data-link-type="biblio" href="#biblio-fmt" title="The {fmt} library">[FMT]</a>).</p>
23292335
</main>

0 commit comments

Comments
 (0)