[Patch] Fix the narrow/widen problem in money_get::do_get

Paolo Carlini pcarlini@suse.de
Thu Feb 26 18:23:00 GMT 2004


Hi,

this is the last missing bit of work, actually for a bug: the
standard is pretty clear that ctype::widen must be used in do_get,
not ctype::narrow (see 22.2.6.1.2, p4 and note 237).

Interestingly, overall, the performance are not affected negatively,
on balance slightly improve (now we can avoid string::assign-ing at
the end of _M_extract). For the testcase that I have always used in
these days (-O2, P4-2400):

do_get(string_type&)
====================
current head - 4.580u 0.010s 0:04.73 97.0%     0+0k 0+0io 256pf+0w
patched head - 4.660u 0.000s 0:04.80 97.0%     0+0k 0+0io 254pf+0w
current 3.4  - 8.660u 0.000s 0:08.96 96.6%     0+0k 0+0io 253pf+0w

do_get(long double&)
====================
current head - 5.100u 0.000s 0:05.23 97.5%     0+0k 0+0io 264pf+0w
patched head - 4.710u 0.000s 0:04.83 97.5%     0+0k 0+0io 262pf+0w
current 3.4  - 9.400u 0.010s 0:09.67 97.3%     0+0k 0+0io 261pf+0w

Regtested x86-linux. If nobody objects will commit later today.

Paolo.

////////////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_money_get
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040226/613e00b0/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_money_get
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040226/613e00b0/attachment-0001.ksh>


More information about the Libstdc++ mailing list