This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Doubts about digit grouping corner cases


Paolo Carlini wrote:

Nathan Myers wrote:

Besides the description of the phases of numeric parsing, there
is also the BNF descriptions of number formats found in the
num_punct section. The idea is, the syntax tells you what
characters to extract, and then the rest tells how to construct a
number from the characters extracted, or to fail.


Perhaps now I get your points. I take it like this: there is a set of,
so to speak, "general requirements" on the groupings, stated in the
num_punct section, to which *any* number must conform. Those must
be checked during Stage2. Then, there are the specific requirements
encoded in do_grouping, which must checked toward the end of Stage3.

Well, this is definitely reasonable, but the description of Stage2
(and Stage3) in 22.2.2.1.2 doesn't mention at all the first part!!
In particular, in 22.2.2.1.2, p8-9 there is absolutely no mention
of the fact that discard may become true or false depending also on
the last parsed char! Not just so, something much stronger: Stage2
may terminate *only* because in == end, not for different reasons,
like two consecutive true discard!!!

Perhaps the Standard should be clarified?!?!

Issue 358 clarifies Stage 2 to terminate the algorithm when a thousands_sep has been seen after a decimal_point has been extracted: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#358

There is a similar problem with 'e' and 'E' (e.g., the string
"123,456e+789,012" should be interpreted as 123456.0e+789,
and the subsequent ',' should terminate input; the returned
iterator should point at the ',' just prior to '0'). An issue
is yet to be filed for it.

Martin



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]