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

Thorsten Glaser <[email protected]> Wed, 19 Mar 2025 16:56:32 +0100 (CET)
Newsgroups dev.linux.lists.liba2i
Message-ID <[email protected]>
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=E2=80=A6

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

=E2=80=A6 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=E2=80=99t Cc me explicitly on this thread.
--=20
13:28=E2=8E=9C=C2=ABneurodamage:#cvs=C2=BB you're a handy guy to have aroun=
d for systems stuff =E2=98=BA
16:06=E2=8E=9C<Draget:#cvs> Thank god I found you =3D)   20:03=E2=94=82=C2=
=ABbioe007:#cvs=C2=BB mira2k: ty
17:14=E2=8E=9C<ldiain:#cvs> Thanks big help you are :-)   <bioe007> mira|nw=
t: ty again
18:36=E2=8E=9C=C2=ABThunderChicken:#cvs=C2=BB mirabilos FTW!  23:03=E2=8E=
=9C=C2=ABmithraic:#cvs=C2=BB aaah. thanks