[Patch] Lot of work on _M_extract_float and _int

Paolo Carlini pcarlini@suse.de
Sat Oct 25 16:44:00 GMT 2003


Hi,

this little monster does a few not trivial things. Most notably:

  1- As pointed out in my previous message, we were systematically
     risking end iterator dereference. I have changed the logic of
     both functions to avoid that.

  2- The code skipping the leading zeros was not particularly smart,
     assigning repeatedly to __found_zero. I have improved it,
     sparing the variable and having all the zeros besides the first
     skipped by way of a tight loop.

  3- The logic using __pos in order to detect parsing errors involving
     the exponential char was flawed in two cases: both a +/- sign
     or a decimal point incremented __pos and the parsing of 'e'/'E'
     could proceed. This is wrong, because the standard prescribes
     that the sequence of digits in the mantissa (before 'e'/'E', that
     is) must be non-empty. Now a boolean __found_mantissa is set
     carefully only when appropriate.

Tested x86-linux, will wait 'til monday for comments...

Paolo.

/////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_big
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20031025/223b6141/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_big
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20031025/223b6141/attachment-0001.ksh>


More information about the Libstdc++ mailing list