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 Tue, 18 Mar 2025, Alejandro Colomar wrote:

>> To address this adoption problem, how about changing these function to
>> generic functions (in the sense of <tgmath.h>)? In such a way that
>>     strtoi (n, &end, base, LONG_MIN, LONG_MAX, &status)
>> is known to return a 'long' rather than 'intmax_t', and
>>     strtoi (n, &end, base, INT_MIN, INT_MAX, &status)

That, and especially…

>I have designed a better API, through a type-generic macro:
>
>	int
>	a2i(typename T, T *restrict n, QChar *s,
>	    QChar *_Optional *restrict endp, int base,
>	    T min, T max);
[…]

… this is a nightmare. This effectively will prevent people from
adding that to systems that do not use C2y as primary/only target
yet, and mixing code.

(Besides, a2i is a too generic name.)

bye,
//mirabilos
PS: Please don’t Cc me explicitly on this thread.
-- 
13:28⎜«neurodamage:#cvs» you're a handy guy to have around for systems stuff ☺
16:06⎜<Draget:#cvs> Thank god I found you =)   20:03│«bioe007:#cvs» mira2k: ty
17:14⎜<ldiain:#cvs> Thanks big help you are :-)   <bioe007> mira|nwt: ty again
18:36⎜«ThunderChicken:#cvs» mirabilos FTW!  23:03⎜«mithraic:#cvs» aaah. thanks


Home | Main Index | Thread Index | Old Index