374. moneypunct::frac_digits returns int not unsigned

Section: 25.4.6.3.1 [locale.moneypunct.members], 25.4.6.3.2 [locale.moneypunct.virtuals] Status: NAD Submitter: Ray Lischner Opened: 2002-08-08 Last modified: 2016-02-10

Priority: Not Prioritized

View all issues with NAD status.

Discussion:

In section 25.4.6.3.1 [locale.moneypunct.members], frac_digits() returns type "int". This implies that frac_digits() might return a negative value, but a negative value is nonsensical. It should return "unsigned".

Similarly, in section 25.4.6.3.2 [locale.moneypunct.virtuals], do_frac_digits() should return "unsigned".

Proposed resolution:

Rationale:

Regardless of whether the return value is int or unsigned, it's always conceivable that frac_digits might return a nonsensical value. (Is 4294967295 really any better than -1?) The clients of moneypunct, the get and put facets, can and do perform range checks.