tech-misc archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: alx-0008 - Standardize strtoi(3) and strtou(3) from NetBSD
On Thu, 20 Mar 2025, Alejandro Colomar wrote:
>> At the same time, disallowing a leading '-' sign
>> is a benefit as well. I consider it a misfeature that strtoul() parses
>> "-3" successfully and returns ULONG_MAX-2, which was most certainly
>> not intended by the user.
>
>Agree; it is a misfeature.
What?
From a user’s PoV, this is hugely useful, and many other
read-unsigned-integer-value routines handle this similarily
(of course using whatever range they have) and C also defines
this, so from an implementor’s PoV this is no trouble.
The other user’s PoV thing would be to allow 0x prefixing,
but that needs an entire duplication of the inner loop, so
I can see why people would want to exclude that.
bye,
//mirabilos
--
22:20⎜<asarch> The crazy that persists in his craziness becomes a master
22:21⎜<asarch> And the distance between the craziness and geniality is
only measured by the success 18:35⎜<asarch> "Psychotics are consistently
inconsistent. The essence of sanity is to be inconsistently inconsistent
Home |
Main Index |
Thread Index |
Old Index