[RFC] Doubts about digit grouping corner cases

Nathan Myers ncm-nospam@cantrip.org
Sat Jan 3 23:54:00 GMT 2004


On Sat, Jan 03, 2004 at 12:47:29PM +0100, Paolo Carlini wrote:
> Hi,
> 
> according to the standard, digit grouping is checked during Stage 3:
> 22.2.2.1.2, p12.
> 
> However, we have some code in _M_extract_int (and float) dealing with
> corner cases (basically, __sep_pos == 0) during Stage 2. Testcases
> in:
> 
>    27_io/basic_istream/extractors_arithmetic/char/07.cc
> 
> It seems to me that we could deal easily - and in a strictly conforming
> way - with __sep_pos == 0 in __verify_grouping, thus simplifying the
> Stage2 parsing loop.
> 
> The only user visible effect would be that the iterator would point
> after the last digit, not to the first bad thousands_sep. But, again,
> in my reading, this is conforming.

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.

Nathan Myers
ncm-nospam@cantrip.org



More information about the Libstdc++ mailing list