This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: strtoul etc.


Nathan Myers <ncm@cantrip.org> writes:

> Using the strtoul() family for conversion is just wrong.

It's not.  It's memory efficient and fast.  Note that the base
parameter is not 0.

If you implemented strtoll etc *fast* you'd know how much work it is.

> While filling the buffer to pass to strtoul, you have already
> done all of its work except for the most trivial part -- a
> multiply-and-add.

See.  You don't even see the real problem.

> Furthermore, the C functions do not detect overflow, where C++ is
> required to detect and report overflow and similar errors, so
> besides being slower, it's wrong.

Of course strtol & friends detect overflows.

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]