Skip to content

Commit 2c6d215

Browse files
committed
Fix markdown code block wrapping which was causing pdf font issues
1 parent 9497580 commit 2c6d215

11 files changed

+208
-125
lines changed

CLAUDE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,29 @@ Rules for all work on WG21 papers in this repository.
9696
summarize arithmetic or data
9797
30. Align trailing comment columns when consecutive lines have
9898
trailing comments
99+
31. Fenced code blocks must not exceed 80 characters per
100+
line. This rule does not apply to mermaid blocks -
101+
never reformat mermaid source. When wrapping is
102+
needed, follow the conventions for the block's
103+
language:
104+
105+
**C++** - break at a natural syntactic boundary and
106+
indent the continuation 4 spaces from the construct
107+
it belongs to:
108+
- Function signatures: break after the return type,
109+
or after the opening parenthesis
110+
- Template parameter lists: break after a comma,
111+
align with the first parameter or indent 4 spaces
112+
- Chained expressions (pipe `|`, `<<`, etc.): break
113+
before the operator, align operators vertically
114+
- Trailing comments: shorten the gap between code and
115+
comment rather than wrapping the code, but keep
116+
grouped comments aligned with each other (rule 30)
117+
- If shortening the gap is not enough, move the
118+
comment to the line above the code it describes
119+
120+
**Prose in code fences** (markdown, plain text) -
121+
wrap at word boundaries with no continuation indent
99122

100123
## Structure
101124

d4003-coroutine-io.html

Lines changed: 51 additions & 41 deletions
Large diffs are not rendered by default.

d4003-coroutine-io.pdf

1.1 KB
Binary file not shown.

d4007-senders-and-coros.html

Lines changed: 53 additions & 42 deletions
Large diffs are not rendered by default.

d4007-senders-and-coros.pdf

1.74 KB
Binary file not shown.

d4035-escape-hatches.html

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -837,8 +837,8 @@ <h2 class="toc-title">Table of Contents</h2>
837837
<li><a href="#revision-history" id="toc-revision-history">Revision
838838
History</a>
839839
<ul>
840-
<li><a href="#r0-february-2026-pre-tokyo-mailing" id="toc-r0-february-2026-pre-tokyo-mailing">R0: February 2026
841-
(pre-Tokyo mailing)</a></li>
840+
<li><a href="#r0-february-2026-post-croydon-mailing" id="toc-r0-february-2026-post-croydon-mailing">R0: February 2026
841+
(post-Croydon mailing)</a></li>
842842
</ul></li>
843843
<li><a href="#the-need-for-escape-hatches" id="toc-the-need-for-escape-hatches">1. The Need for Escape
844844
Hatches</a></li>
@@ -859,17 +859,17 @@ <h2 id="abstract">Abstract</h2>
859859
possible.”</p>
860860
<hr />
861861
<h2 id="revision-history">Revision History</h2>
862-
<h3 id="r0-february-2026-pre-tokyo-mailing">R0: February 2026 (pre-Tokyo
863-
mailing)</h3>
862+
<h3 id="r0-february-2026-post-croydon-mailing">R0: February 2026
863+
(post-Croydon mailing)</h3>
864864
<ul>
865865
<li>Initial version.</li>
866866
</ul>
867867
<hr />
868868
<h2 id="the-need-for-escape-hatches">1. The Need for Escape Hatches</h2>
869869
<p>Safe interfaces should be the default. They should validate input,
870870
maintain invariants, and protect users from misuse. However, C++ also
871-
needs an explicit path for trusted data - when the invariant is already
872-
established at a boundary and re-validation is pure overhead.</p>
871+
needs an explicit path for trusted data - when the precondition is
872+
already satisfied at a boundary and re-validation is pure overhead.</p>
873873
<p>This pattern appears in the standard library, in production Boost
874874
libraries, and in the current <code>cstring_view</code> proposal. Three
875875
independent examples follow.</p>
@@ -905,7 +905,7 @@ <h2 id="established-practice">3. Established Practice</h2>
905905
encoding before extracting URL components. Repeating that validation
906906
would be redundant. A separate function bypasses it at the trusted
907907
boundary:</p>
908-
<div class="sourceCode" id="cb3"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co">// Escape hatch: invariant already established by the parser.</span></span>
908+
<div class="sourceCode" id="cb3"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co">// Escape hatch: precondition already satisfied by the parser.</span></span>
909909
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>pct_string_view s <span class="op">=</span> make_pct_string_view_unsafe<span class="op">(</span>data<span class="op">,</span> size<span class="op">,</span> decoded_size<span class="op">);</span></span></code></pre></div>
910910
<p>This pattern was adopted independently by three Boost libraries:
911911
Boost.URL (<a href="https://github.com/boostorg/url/blob/develop/include/boost/url/pct_string_view.hpp"><code>make_pct_string_view_unsafe</code></a><sup>[4]</sup>),
@@ -918,9 +918,8 @@ <h2 id="application-level">4. Application Level</h2>
918918
pointer and a filename length via <code>dirent</code>
919919
(<code>d_name</code> and <code>d_namlen</code>) <a href="https://man.freebsd.org/cgi/man.cgi?query=readdir&amp;sektion=3">FreeBSD
920920
<code>readdir(3)</code></a><sup>[7]</sup> and <a href="https://cgit.freebsd.org/src/tree/sys/sys/dirent.h">FreeBSD
921-
<code>dirent.h</code></a><sup>[8]</sup>. The common invariant for path
922-
components is that names are null-terminated and do not contain embedded
923-
null bytes <a href="https://pubs.opengroup.org/onlinepubs/9799919799/">POSIX Base
921+
<code>dirent.h</code></a><sup>[8]</sup>. POSIX requires that path
922+
components are null-terminated and contain no embedded null bytes <a href="https://pubs.opengroup.org/onlinepubs/9799919799/">POSIX Base
924923
Definitions</a><sup>[9]</sup>. Rescanning each name in a validating
925924
constructor repeats work the operating system already did.</p>
926925
<div class="sourceCode" id="cb4"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> visit_directory<span class="op">(</span>DIR<span class="op">*</span> dir<span class="op">)</span></span>
@@ -930,22 +929,23 @@ <h2 id="application-level">4. Application Level</h2>
930929
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="at">const</span> <span class="dt">char</span><span class="op">*</span> p <span class="op">=</span> de<span class="op">-&gt;</span>d_name<span class="op">;</span></span>
931930
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="bu">std::</span>size_t n <span class="op">=</span> de<span class="op">-&gt;</span>d_namlen<span class="op">;</span></span>
932931
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a></span>
933-
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> <span class="co">// Trusted boundary: OS already established the invariant.</span></span>
932+
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> <span class="co">// Trusted boundary: OS already satisfied the precondition.</span></span>
934933
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a> cstring_view name <span class="op">=</span> cstring_view<span class="op">::</span>unsafe<span class="op">(</span>p<span class="op">,</span> n<span class="op">);</span></span>
935934
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a> consume<span class="op">(</span>name<span class="op">);</span></span>
936935
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
937936
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
938937
<p>The safe path remains the default for untrusted input. The unsafe
939-
path exists for proven invariants and zero additional runtime cost.</p>
938+
path exists for proven preconditions and zero additional runtime
939+
cost.</p>
940940
<h2 id="conclusion">5. Conclusion</h2>
941941
<p>The standard library already provides constrained defaults with
942942
explicit broader counterparts. Production libraries independently
943943
converge on the same pattern for trusted boundaries. This paper asks for
944944
no wording and no poll. It asks the committee to recognize a design
945945
value: safe by default, with explicit escape hatches where zero-cost
946946
composition requires them.</p>
947-
<p>The interaction between explicit escape hatches and hardened
948-
precondition checking is a related question that deserves separate
947+
<p>How explicit escape hatches interact with Hardening, Contracts, and
948+
Erroneous Behavior is a related question that deserves separate
949949
treatment.</p>
950950
<hr />
951951
<h1 id="acknowledgements">Acknowledgements</h1>

d4035-escape-hatches.pdf

2.1 KB
Binary file not shown.

source/d4003-coroutine-io.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Coroutines for I/O"
3-
document: P4003R0
3+
document: P4003R1
44
date: 2026-02-22
55
reply-to:
66
- "Vinnie Falco <vinnie.falco@gmail.com>"
@@ -157,7 +157,9 @@ struct my_awaitable
157157
bool await_ready() const noexcept { return false; }
158158
159159
// This signature satisfies IoAwaitable
160-
std::coroutine_handle<> await_suspend( std::coroutine_handle<> cont, io_env const* env )
160+
std::coroutine_handle<>
161+
await_suspend( std::coroutine_handle<> cont,
162+
io_env const* env )
161163
{
162164
cont_ = cont;
163165
env_ = env;
@@ -304,7 +306,9 @@ struct task
304306
T await_resume() { return h_.promise().result(); }
305307
306308
// Satisfies IoAwaitable
307-
std::coroutine_handle<> await_suspend( std::coroutine_handle<> cont, io_env const* env )
309+
std::coroutine_handle<>
310+
await_suspend( std::coroutine_handle<> cont,
311+
io_env const* env )
308312
{
309313
h_.promise().set_continuation( cont );
310314
h_.promise().set_environment( env );
@@ -434,10 +438,12 @@ A launch function (e.g., `run_async`, `run`) bridges non-coroutine code into the
434438

435439
```cpp
436440
template<Executor Ex, class... Args>
437-
unspecified run_async( Ex ex, Args&&... args ); // returns wrapper, caller invokes with task
441+
// returns wrapper, caller invokes with task
442+
unspecified run_async( Ex ex, Args&&... args );
438443

439444
template<Executor Ex, class... Args>
440-
unspecified run( Ex ex, Args&&... args ); // returns wrapper for co_await
445+
// returns wrapper for co_await
446+
unspecified run( Ex ex, Args&&... args );
441447
```
442448
443449
**Requirements:**
@@ -594,7 +600,8 @@ concept ExecutionContext =
594600
requires(X& x) {
595601
typename X::executor_type;
596602
requires Executor<typename X::executor_type>;
597-
{ x.get_executor() } noexcept -> std::same_as<typename X::executor_type>;
603+
{ x.get_executor() } noexcept
604+
-> std::same_as<typename X::executor_type>;
598605
};
599606
```
600607
@@ -622,7 +629,8 @@ Coroutine frame allocation has a fundamental timing constraint: `operator new` e
622629
auto t = my_coro(sock); // operator new called HERE
623630
co_await t; // await_transform kicks in HERE (too late)
624631
625-
spawn( my_coro(sock) ); // my_coro(sock) evaluated BEFORE calling spawn (too late)
632+
// my_coro(sock) evaluated BEFORE calling spawn (too late)
633+
spawn( my_coro(sock) );
626634
```
627635
628636
### 5.2 The Awkward Approach
@@ -1262,7 +1270,9 @@ concept io_runnable =
12621270
requires { typename T::promise_type; } &&
12631271
requires(T& t, T const& ct, typename T::promise_type const& cp,
12641272
typename T::promise_type& p) {
1265-
{ ct.handle() } noexcept -> same_as<coroutine_handle<typename T::promise_type>>;
1273+
{ ct.handle() } noexcept
1274+
-> same_as<coroutine_handle<
1275+
typename T::promise_type>>;
12661276
{ cp.exception() } noexcept -> same_as<exception_ptr>;
12671277
{ t.release() } noexcept;
12681278
{ p.set_continuation(coroutine_handle<>{}) } noexcept;

source/d4007-senders-and-coros.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Senders and Coroutines"
3-
document: P4007R0
3+
document: P4007R1
44
date: 2026-02-22
55
reply-to:
66
- "Vinnie Falco <vinnie.falco@gmail.com>"
@@ -165,7 +165,8 @@ read(tcp::socket& sock)
165165
for (;;)
166166
{
167167
auto [ec, n] = co_await sock.read_some(buf); // also a tuple
168-
result.append(buf, n); // n bytes arrived regardless of ec
168+
// n bytes arrived regardless of ec
169+
result.append(buf, n);
169170
if (ec)
170171
co_return {ec, std::move(result)};
171172
}
@@ -206,14 +207,14 @@ sender_of<dynamic_buffer> auto async_read_array(auto handle) {
206207
return just(std::as_writeable_bytes(std::span(&buf.size, 1)))
207208
| async_read(handle)
208209
| then(
209-
[&buf] (std::size_t bytes_read) { // from set_value
210+
[&buf] (std::size_t bytes_read) { // from set_value
210211
assert(bytes_read == sizeof(buf.size));
211212
buf.data = std::make_unique<std::byte[]>(buf.size);
212213
return std::span(buf.data.get(), buf.size);
213214
})
214215
| async_read(handle)
215216
| then(
216-
[&buf] (std::size_t bytes_read) { // from set_value
217+
[&buf] (std::size_t bytes_read) { // from set_value
217218
assert(bytes_read == buf.size);
218219
return std::move(buf);
219220
});
@@ -412,7 +413,7 @@ do_read(tcp_socket& s, buffer& buf)
412413
{
413414
auto [ec, n] = co_await s.async_read(buf);
414415
if (ec)
415-
co_yield with_error(ec); // unfortunately, terminates the coroutine
416+
co_yield with_error(ec); // unfortunately, terminates the coroutine
416417
co_return n;
417418
}
418419
```
@@ -526,8 +527,10 @@ recycling_allocator<> alloc;
526527
auto op = connect(
527528
write_env(
528529
ex::on(sch,
529-
handle_connection(std::move(conn))), // operator new allocates here...
530-
prop(get_allocator, alloc)), // ...but allocator arrives here
530+
// operator new allocates here...
531+
handle_connection(std::move(conn))),
532+
// ...but allocator arrives here
533+
prop(get_allocator, alloc)),
531534
rcvr);
532535
start(op);
533536
```
@@ -875,9 +878,16 @@ struct read_op
875878
{
876879
struct recv_rcvr {
877880
read_op* self_;
878-
void set_value(std::size_t n) && noexcept { self_->completed({}, n); }
879-
void set_error(std::error_code ec) && noexcept { self_->completed(ec, 0); }
880-
void set_stopped() && noexcept { execution::set_stopped(std::move(self_->rcvr_)); }
881+
void set_value(std::size_t n) && noexcept {
882+
self_->completed({}, n);
883+
}
884+
void set_error(std::error_code ec) && noexcept {
885+
self_->completed(ec, 0);
886+
}
887+
void set_stopped() && noexcept {
888+
execution::set_stopped(
889+
std::move(self_->rcvr_));
890+
}
881891
};
882892

883893
Rcvr rcvr_;
@@ -902,7 +912,8 @@ struct read_op
902912
return execution::set_value(std::move(rcvr_), bytes_read_);
903913
if (!ec)
904914
return start_recv();
905-
execution::set_error(std::move(rcvr_), ec); // bytes_read_ bytes are lost
915+
// bytes_read_ bytes are lost
916+
execution::set_error(std::move(rcvr_), ec);
906917
}
907918
};
908919
```

source/d4014-sender-sub-language.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "The Sender Sub-Language"
3-
document: P4014R0
3+
document: P4014R1
44
date: 2026-02-22
55
reply-to:
66
- "Vinnie Falco <vinnie.falco@gmail.com>"

0 commit comments

Comments
 (0)