Created on 2019-07-31.00:00:00 last changed 45 months ago
Proposed resolution:
This wording is relative to N4830.
Modify the width and precision grammar in the syntax of format specifications of [format.string.std] as indicated:
[…] width: positive-integer { arg-idopt } precision: . nonnegative-integer . { arg-idopt } […]
Modify [format.string.std] as indicated:
-6- The # option causes […]
-?- If { arg-idopt } is used in a width or precision, the value of the corresponding formatting argument is used in its place. If the corresponding formatting argument is not of integral type, or its value is negative for precision or non-positive for width, an exception of type format_error is thrown. -7- The positive-integer in width is a decimal integer defining the minimum field width. If width is not specified, there is no minimum field width, and the field width is determined based on the content of the field.
[ 2020-02 Status to Immediate on Thursday morning in Prague. ]
According to [format.string] we have:
If the numeric arg-ids in a format string are 0, 1, 2, ... in sequence, they can all be omitted (not just some) and the numbers 0, 1, 2, ... will be automatically used in that order. A format string does not contain a mixture of automatic and manual indexing.
… but what does that mean in the presence of arg-id in width and precision? Can one replace
"{0:{1}} {2}"
with
"{:{}} {}"
? The grammar says the answer is no, because the arg-id in width is not optional, but the normative wording says the answer is yes.
Victor Zverovich: That's a bug in the grammar. The arg-id should be optional in width and precision:width ::= nonzero-digit [integer] | '{' [arg-id] '}' precision ::= integer | '{' [arg-id] '}'
History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2020-02-24 16:02:59 | admin | set | status: immediate -> wp |
2020-02-13 12:32:11 | admin | set | messages: + msg11056 |
2020-02-13 12:32:11 | admin | set | status: new -> immediate |
2019-08-02 18:34:47 | admin | set | messages: + msg10530 |
2019-07-31 00:00:00 | admin | create |