This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
std::format_to
?Section: 22.14.5 [format.functions] Status: New Submitter: Jan Schultke Opened: 2024-04-24 Last modified: 2024-04-27
Priority: Not Prioritized
View all other issues in [format.functions].
View all issues with New status.
Discussion:
int main() { int x = 12345; // note: this is "awoo" followed by 28 zeros (9.4.3 [dcl.init.string] p3) char buffer[32] = "awoo"; std::format_to(buffer, "{}{}", x, buffer); std::println("{}", buffer); }
The output of this code is unspecified to be either "1234512345"
or "12345awoo"
,
where GCC currently outputs the former. Formatting occurs through function calls
(see 22.14.6.4 [format.formatter.spec] p1) and those cannot be unsequenced, however, it's also
nowhere stated in what order the arguments get formatted and how the output iterator is advanced
between calls to the formatters.
f.format(u, fc)
).
Proposed resolution: