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

Thorsten Glaser <[email protected]> Thu, 20 Mar 2025 01:31:37 +0100 (CET)
Newsgroups gmane.os.netbsd.devel.general
Message-ID <[email protected]>
On Thu, 20 Mar 2025, Alejandro Colomar wrote:

>> From a user=E2=80=99s 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=E2=80=99s PoV this is no trouble.
>
>Can you clarify how this is useful as a programmer?  I have replaced
>*all* calls to strtoul(3) et al. in shadow-utils by my strtou_noneg(),
>and never ever saw a valid use case of that feature.

I said useful for users (and no bother to programmers).

This way, users can do things like './a.out -x $((something))'
and have it work even if that something ends up negative in
the shell (not all shells have a way for unsigned arithmetic
output).

>> The other user=E2=80=99s PoV thing would be to allow 0x prefixing,

>I don't understand what you mean.  strtou(3) supports 0x strings as

Oh, right, it=E2=80=99s one of those where you specify the base.
I might have been confused by too many things at talk at
the same time.

Or just need sleep. Good night to you as well,
//mirabilos
--=20
Solange man keine schmutzigen Tricks macht, und ich meine *wirklich*
schmutzige Tricks, wie bei einer doppelt verketteten Liste beide
Pointer XORen und in nur einem Word speichern, funktioniert Boehm ganz
hervorragend.=09=09-- Andreas Bogk =C3=BCber boehm-gc in d.a.s.r