Skip to content

Commit

Permalink
Update paper
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Mar 17, 2024
1 parent bf6cae7 commit 688c257
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
15 changes: 8 additions & 7 deletions papers/p3107.bs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Group: WG21
URL:
Editor: Victor Zverovich, [email protected]
No abstract: true
Date: 2024-03-17
Date: 2024-03-18
Markup Shorthands: markdown yes
</pre>

Expand Down Expand Up @@ -277,14 +277,14 @@ preventing dynamic allocations for the common case, this paper proposes making
user-defined formatters opt into the new behavior. All standard formatters are
nonlocking and will be opted in which means that `std::print` can be used as
a replacement for all current uses of `printf` without concerns that it causes
unbounded memory allocation. The opt in is done via the `nonlocking` nested
type:
unbounded memory allocation. The opt in is done via the `static constexpr bool`
member variable named `locking`:

```
struct foo {};

template <> struct fmt::formatter<foo> {
using nonlocking = void;
static constexpr bool locking = false;
// ...
};
```
Expand Down Expand Up @@ -433,8 +433,8 @@ template<class... Args>
*Effects*:

<ins>
Let `locksafe` be `true` if `formatter<remove_cvref_t<Arg>>::nonlocking` is
valid and denotes a type for all `Arg` in `Args`, `false` otherwise.
Let `locksafe` be `true` if `formatter<remove_cvref_t<Arg>>::locking` is
valid and evaluates to `false` for all `Arg` in `Args`, `false` otherwise.
</ins>

If the ordinary literal encoding ([[lex.charset](
Expand Down Expand Up @@ -569,7 +569,8 @@ The parse member functions of these formatters interpret the format
specification as a *std-format-spec* as described in
[[format.string.std](https://eel.is/c++draft/format.string.std)].

<ins>These formatters define an unspecified nested type named `nonlocking`.</ins>
<ins>These formatters define a `static constexpr bool` member variable named
`locking` that evaluates to `false`.</ins>

[*Note 1*: Specializations such as `formatter<wchar_t, char>` and
`formatter<const char*, wchar_t>` that would require implicit multibyte /
Expand Down
15 changes: 7 additions & 8 deletions papers/p3107.html
Original file line number Diff line number Diff line change
Expand Up @@ -1563,7 +1563,7 @@
</style>
<meta content="Bikeshed version 4416b18d5, updated Tue Jan 2 15:52:39 2024 -0800" name="generator">
<link href="https://isocpp.org/favicon.ico" rel="icon">
<meta content="6393afb630b3d5d54594e548a70a11140ba13141" name="revision">
<meta content="bf6cae7ead7236dfca059549c68d395f63ab4083" name="revision">
<style>/* Boilerplate: style-autolinks */
.css.css, .property.property, .descriptor.descriptor {
color: var(--a-normal-text);
Expand Down Expand Up @@ -2087,7 +2087,7 @@
<div class="head">
<p data-fill-with="logo"></p>
<h1 class="p-name no-ref" id="title">P3107R2<br>Permit an efficient implementation of std::print</h1>
<h2 class="no-num no-toc no-ref heading settled" id="profile-and-date"><span class="content">Published Proposal, <time class="dt-updated" datetime="2024-03-17">2024-03-17</time></span></h2>
<h2 class="no-num no-toc no-ref heading settled" id="profile-and-date"><span class="content">Published Proposal, <time class="dt-updated" datetime="2024-03-18">2024-03-18</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt class="editor">Author:
Expand Down Expand Up @@ -2341,12 +2341,11 @@ <h2 class="heading settled" data-level="5" id="proposal"><span class="secno">5.
user-defined formatters opt into the new behavior. All standard formatters are
nonlocking and will be opted in which means that <code class="highlight"><c- n>std</c-><c- o>::</c-><c- n>print</c-></code> can be used as
a replacement for all current uses of <code class="highlight"><c- n>printf</c-></code> without concerns that it causes
unbounded memory allocation. The opt in is done via the <code class="highlight"><c- n>nonlocking</c-></code> nested
type:</p>
unbounded memory allocation. The opt in is done via the <code class="highlight"><c- k>static</c-> <c- k>constexpr</c-> <c- b>bool</c-></code> member variable named <code class="highlight"><c- n>locking</c-></code>:</p>
<pre class="highlight"><c- k>struct</c-> <c- nc>foo</c-> <c- p>{};</c->

<c- k>template</c-> <c- o>&lt;></c-> <c- k>struct</c-> <c- nc>fmt</c-><c- o>::</c-><c- n>formatter</c-><c- o>&lt;</c-><c- n>foo</c-><c- o>></c-> <c- p>{</c->
<c- k>using</c-> <c- n>nonlocking</c-> <c- o>=</c-> <c- b>void</c-><c- p>;</c->
<c- k>static</c-> <c- k>constexpr</c-> <c- b>bool</c-> <c- n>locking</c-> <c- o>=</c-> false<c- p>;</c->
<c- c1>// ...</c->
<c- p>};</c->
</pre>
Expand Down Expand Up @@ -2466,8 +2465,8 @@ <h2 class="heading settled" data-level="8" id="wording"><span class="secno">8. <
<c- b>void</c-> <c- n>print</c-><c- p>(</c-><c- b>FILE</c-><c- o>*</c-> <c- n>stream</c-><c- p>,</c-> <c- n>format_string</c-><c- o>&lt;</c-><c- n>Args</c-><c- p>...</c-><c- o>></c-> <c- n>fmt</c-><c- p>,</c-> <c- n>Args</c-><c- o>&amp;&amp;</c-><c- p>...</c-> <c- n>args</c-><c- p>);</c->
</pre>
<p><em>Effects</em>:</p>
<ins> Let <code class="highlight"><c- n>locksafe</c-></code> be <code class="highlight">true</code> if <code class="highlight"><c- n>formatter</c-><c- o>&lt;</c-><c- n>remove_cvref_t</c-><c- o>&lt;</c-><c- n>Arg</c-><c- o>>>::</c-><c- n>nonlocking</c-></code> is
valid and denotes a type for all <code class="highlight"><c- n>Arg</c-></code> in <code class="highlight"><c- n>Args</c-></code>, <code class="highlight">false</code> otherwise. </ins>
<ins> Let <code class="highlight"><c- n>locksafe</c-></code> be <code class="highlight">true</code> if <code class="highlight"><c- n>formatter</c-><c- o>&lt;</c-><c- n>remove_cvref_t</c-><c- o>&lt;</c-><c- n>Arg</c-><c- o>>>::</c-><c- n>locking</c-></code> is
valid and evaluates to <code class="highlight">false</code> for all <code class="highlight"><c- n>Arg</c-></code> in <code class="highlight"><c- n>Args</c-></code>, <code class="highlight">false</code> otherwise. </ins>
<p>If the ordinary literal encoding (<a href="https://eel.is/c++draft/version.syn">[lex.charset</a>]) is UTF-8, equivalent to:</p>
<pre class="highlight"><del><c- n>vprint_unicode</c-><c- p>(</c-><c- n>stream</c-><c- p>,</c-> <c- n>fmt</c-><c- p>.</c-><c- n>str</c-><c- p>,</c-> <c- n>make_format_args</c-><c- p>(</c-><c- n>args</c-><c- p>...));</c-></del>
<ins>
Expand Down Expand Up @@ -2554,7 +2553,7 @@ <h2 class="heading settled" data-level="8" id="wording"><span class="secno">8. <
</ul>
<p>The parse member functions of these formatters interpret the format
specification as a <em>std-format-spec</em> as described in <a href="https://eel.is/c++draft/format.string.std">[format.string.std</a>].</p>
<ins>These formatters define an unspecified nested type named <code class="highlight"><c- n>nonlocking</c-></code>.</ins>
<ins>These formatters define a <code class="highlight"><c- k>static</c-> <c- k>constexpr</c-> <c- b>bool</c-></code> member variable named <code class="highlight"><c- n>locking</c-></code> that evaluates to <code class="highlight">false</code>.</ins>
<p>[<em>Note 1</em>: Specializations such as <code class="highlight"><c- n>formatter</c-><c- o>&lt;</c-><c- b>wchar_t</c-><c- p>,</c-> <c- b>char</c-><c- o>></c-></code> and <code class="highlight"><c- n>formatter</c-><c- o>&lt;</c-><c- k>const</c-> <c- b>char</c-><c- o>*</c-><c- p>,</c-> <c- b>wchar_t</c-><c- o>></c-></code> that would require implicit multibyte /
wide string or character conversion are disabled. — end note]</p>
<p>...</p>
Expand Down

0 comments on commit 688c257

Please sign in to comment.