On 2024-09-10 11:45:54 +0100, Jonathan Wakely wrote: > The C standard says you cannot pass null pointers to functions in > <string.h> even with a length of zero. I think it's reasonable to > assume that the rules for all functions in <string.h> in the C > standard also apply to POSIX extensions in <string.h>.
Perhaps. Currently https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/string.h.html says nothing about that. > Otherwise, code written for the POSIX strnlen might become undefined > if/when strnlen gets adopted by the C standard and null pointers are > no longer valid. Not necessarily: POSIX may still define cases that are not defined in the ISO C standard (in particular if the result is obvious in such cases). Isn't this already the case for some functions? -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)