[Bug libstdc++/10985] money_get should heed frac_digits

brendan@zen.org gcc-bugzilla@gcc.gnu.org
Mon May 26 20:54:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10985



------- Additional Comments From brendan@zen.org  2003-05-26 20:50 -------
(This description is appearing in the wrong place in this PR because I hit
return too early in the first try. :-) )

In the standard, the definition of moneypunct says that you can't have a
value for frac_digits and ignore it:

   $22.2.6.3.3/8
   The number of digits required after the decimal point (if any) is exactly
   the value returned by frac_digits().

The libstdc++ implementation of money_get<...>::do_get doesn't enforce this,
which lets people use as many digits as they want.

The attached testcase, tfrac.cpp, shows the places where we shouldn't be
accepting what's being fed into money_get.

In tfrac-diffs.txt, I've presented one approach to correct this.  There is one
curious issue in the fix, though---the name "__sep_pos" is no longer correct.
It's being used both to note the thousands separator and, now, how far we've
gone past the decimal-point that came.

Another approach, aside from renaming it, is actually using a new variable to
count how far we've come since the decimal-point, and thus keeping them
separated.

I'll let you guys decide if you want to do anything about the naming of it,
and will provide a revised patch if there's a style you want to go with.

B





------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the Gcc-bugs mailing list