On 2025-02-08 23:33, Bruno Haible via Gnulib discussion list wrote:
# define strchr(s,c) (typeof(s)) strchr ((s), (c))

This evaluates S twice if S's type is variably modified, which violates the C standard. Also, why use typeof rather than typeof_unqual?

It might be better to just use the _Generic implementation, as that avoids the double-evaluation problem and it should be easier to test one implementation (the one supported by more compilers) as opposed to testing two.

Reply via email to