On 2026-02-20 15:34, Alejandro Colomar wrote:
So, you mean something like this?

        INLINE char *
        (strnul)(const char *s)
        {
                return strchr(s, '\0');
        }

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

Sort of, but not exactly; that implementation would have multiple problems.

I suggest looking how glibc implements the qualifier-generic strchr macro for C, and doing something similar. See glibc commit cd748a63ab1a7ae846175c532a3daab341c62690 dated 2025-11-20.

I don't know about C++.

Reply via email to