Title
num_get<>::do_get stage 2 processing broken
Status
cd1
Section
[facet.num.get.virtuals]
Submitter
Matt Austern

Created on 2000-03-14.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Rationale:

If we're using the technique of widening a string literal, the string literal must contain every character we wish to recognize. This technique has the consequence that alternate representations of digits will not be recognized. This design decision was made deliberately, with full knowledge of that limitation.

Date: 2010-10-21.18:28:33

Proposed resolution:

In 22.2.2.1.2 paragraph 8, replace the line:

static const char src[] = "0123456789abcdefABCDEF+-";

with the line:

static const char src[] = "0123456789abcdefxABCDEFX+-";
Date: 2000-03-14.00:00:00

Stage 2 processing of numeric conversion is broken.

Table 55 in 22.2.2.1.2 says that when basefield is 0 the integral conversion specifier is %i. A %i specifier determines a number's base by its prefix (0 for octal, 0x for hex), so the intention is clearly that a 0x prefix is allowed. Paragraph 8 in the same section, however, describes very precisely how characters are processed. (It must be done "as if" by a specified code fragment.) That description does not allow a 0x prefix to be recognized.

Very roughly, stage 2 processing reads a char_type ct. It converts ct to a char, not by using narrow but by looking it up in a translation table that was created by widening the string literal "0123456789abcdefABCDEF+-". The character "x" is not found in that table, so it can't be recognized by stage 2 processing.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg1897
2010-10-21 18:28:33adminsetmessages: + msg1896
2000-03-14 00:00:00admincreate