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:

>> 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.
>
>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’s PoV thing would be to allow 0x prefixing,

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

Oh, right, it’s 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
-- 
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.		-- Andreas Bogk über boehm-gc in d.a.s.r


Home | Main Index | Thread Index | Old Index