File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?xml version =' 1.0' encoding =' utf-8' standalone =' no' ?>
2
+ <!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3
+
4
+ <issue num =" 4263" status =" New" >
5
+ <title >What should `std::format_to` etc. behave when the output is overlong?</title >
6
+ <section ><sref ref =" [format]" /></section >
7
+ <submitter >Jiang An</submitter >
8
+ <date >14 May 2025</date >
9
+ <priority >99</priority >
10
+
11
+ <discussion >
12
+ <p >
13
+ It seems permitted to write overly long contents via an (C++20) output iterator with
14
+ `std::format_to(_n)`, where the length isn't representable in `size_t` or `ptrdiff_t`,
15
+ especially when the implementation provides integer-class types. However, currently
16
+ some implementation can't properly handle content whose length is greater than
17
+ `PTRDIFF_MAX`. Presumably we don't want UB in such cases. Should we explicitly allow
18
+ throwing exception and/or silent truncation?
19
+ <p />
20
+ Additionally, given that the return type of `std::formatted_size` is `std::size_t`,
21
+ even if the implementation supports formatted contents whose lengths are greater than
22
+ `SIZE_MAX`, the length can't be correctly returned. Perhaps we need to either precisely
23
+ specify the return value as modulo arithmetic seems undesired, or specify that an
24
+ exception is thrown.
25
+ </p >
26
+ </discussion >
27
+
28
+ <resolution >
29
+ </resolution >
30
+
31
+ </issue >
You can’t perform that action at this time.
0 commit comments