This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67799] The function strtoul and strtoull in <cstdlib> do not work correctly
- From: "8826055 at 163 dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 01 Oct 2015 15:52:41 +0000
- Subject: [Bug c++/67799] The function strtoul and strtoull in <cstdlib> do not work correctly
- Auto-submitted: auto-generated
- References: <bug-67799-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67799
8826055 at 163 dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |---
--- Comment #2 from 8826055 at 163 dot com ---
(In reply to Jonathan Wakely from comment #1)
> If you look in <cstdlib> you will see these functions are not provided by
> GCC's header, they come from your C library, so this is nothing to do with
> GCC.
>
> In any case, cplusplus.com is wrong, the functions behave as required by the
> C standard:
>
> If the subject sequence begins with a minus sign, the value resulting from
> the conversion is negated (in the return type).
But the C standard also says "If the correct value is outside the range of
representable values, LONG_MIN, LONG_MAX, LLONG_MIN, LLONG_MAX, ULONG_MAX, or
ULLONG_MAX is returned (according to the return type and sign of the value, if
any)".