On 2026-02-21T01:59:57+0100, Bruno Haible wrote:
> Alejandro Colomar asks:
> > And if we don't make strchr(3) etc. const-generic, do you want to
> > make strnul() const-generic?
> 
> Yes, strnul() should be made const-generic.
> 
> The reason: Think five years ahead, when most developers will use
> glibc headers with const-generic strchr(). Then any function that
> Gnulib adds and that could be const-generic but isn't would appear
> old-style or outdated.

But if you define

        #define strnul(s)  strchr(s, '\0')

it will be const-generic as soon as strchr(3) becomes const-generic in
libc.  Wouldn't that be enough?

> In other words, strnul() being a Gnulib addition, it's Gnulib's
> responsibility to make it const-generic (for those compilers that
> support _Generic; possibly with a 'template' alternative in C++ mode).

Cheers,
Alex

-- 
<https://www.alejandro-colomar.es>

Attachment: signature.asc
Description: PGP signature

Reply via email to