Groups | Search | Server Info | Login | Register


Groups > muc.lists.netbsd.tech.misc > #106

Re: alx-0008 - Standardize strtoi(3) and strtou(3) from NetBSD

From Thorsten Glaser <tg@mirbsd.org>
Newsgroups muc.lists.netbsd.tech.misc
Subject Re: alx-0008 - Standardize strtoi(3) and strtou(3) from NetBSD
Date 2025-03-20 00:52 +0100
Organization Newsgate at muc.de e.V.
Message-ID <0b23c187-a102-119c-d6dd-187c92e18448@mirbsd.org> (permalink)
References <x34jdlyb6gf6asojjhzwpol5schyz4llk2ebrtzpb7ryje52u6@smbvzpoqcf6v> <>

Show all headers | View raw


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

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de

Back to muc.lists.netbsd.tech.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: alx-0008 - Standardize strtoi(3) and strtou(3) from NetBSD Alejandro Colomar <alx@kernel.org> - 2025-03-20 00:12 +0100
  strtou(3) handling of negative input Alejandro Colomar <alx@kernel.org> - 2025-03-20 00:30 +0100
  Re: alx-0008 - Standardize strtoi(3) and strtou(3) from NetBSD Thorsten Glaser <tg@mirbsd.org> - 2025-03-20 00:52 +0100
    Re: alx-0008 - Standardize strtoi(3) and strtou(3) from NetBSD Alejandro Colomar <alx@kernel.org> - 2025-03-20 01:19 +0100
      Re: alx-0008 - Standardize strtoi(3) and strtou(3) from NetBSD Thorsten Glaser <tg@mirbsd.org> - 2025-03-20 01:31 +0100
        Re: alx-0008 - Standardize strtoi(3) and strtou(3) from NetBSD Alejandro Colomar <alx@kernel.org> - 2025-03-20 01:36 +0100
  nullability of status parameter in strtoi/u(3) Alejandro Colomar <alx@kernel.org> - 2025-03-20 00:52 +0100
  Re: alx-0008 - Standardize strtoi(3) and strtou(3) from NetBSD Bruno Haible <bruno@clisp.org> - 2025-03-20 13:44 +0100
  Re: alx-0008 - Standardize strtoi(3) and strtou(3) from NetBSD Bruno Haible <bruno@clisp.org> - 2025-03-20 15:26 +0100
    Re: alx-0008 - Standardize strtoi(3) and strtou(3) from NetBSD Alejandro Colomar <alx@kernel.org> - 2025-03-20 15:54 +0100

csiph-web