Re: [hackers] [libgrapheme] Refine types (uint8_t -> char, uint32_t -> uint_least32_t) || Laslo Hunhold

From: Laslo Hunhold <dev_AT_frign.de>
Date: Sun, 12 Dec 2021 09:11:39 +0100

On Sun, 12 Dec 2021 08:59:04 +0100
Laslo Hunhold <dev_AT_frign.de> wrote:

Dear Michael,

> Two questions remain:
>
> 1) Would you also go down the route of just demanding an array of
> unsigned integers of at least 8 bits?
> 2) Would you define it as "unsigned char *" or "uint_least8_t *"?
> I'd almost favor the latter, given the entire library is already
> using the stdint-types.

and there's also POSIX to think about. Given we're using POSIX
interfaces all over libgrapheme and POSIX states "(The POSIX standard
explicitly requires 8-bit char and two's-complement arithmetic.)"[0],
maybe simply going with "uint8_t *" is the real deal.

This still justifies the use of uint_least32_t, as POSIX does not
mandate uint32_t to exist, but we can legally assume an 8-bit-type
exists. This might be stronger to convey in the API using the explicit
uint8_t rather than using "unsigned char", which still has all the
"legacy" attached to it, and FFIs have no open questions about what we
are accepting.

With best regards

Laslo

[0]:https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdint.h.html
Received on Sun Dec 12 2021 - 09:11:39 CET

This archive was generated by hypermail 2.3.0 : Sun Dec 12 2021 - 09:12:34 CET