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)

  • Is strnlen(0,0) val... Vincent Lefevre via austin-group-l at The Open Group
    • Re: Is strnlen... Jonathan Wakely via austin-group-l at The Open Group
      • Re: Is str... Vincent Lefevre via austin-group-l at The Open Group
        • Re: Is... Geoff Clare via austin-group-l at The Open Group
          • Re... Vincent Lefevre via austin-group-l at The Open Group
            • ... Geoff Clare via austin-group-l at The Open Group
              • ... Vincent Lefevre via austin-group-l at The Open Group
                • ... Geoff Clare via austin-group-l at The Open Group
                • ... Vincent Lefevre via austin-group-l at The Open Group
                • ... Alejandro Colomar via austin-group-l at The Open Group
                • ... Geoff Clare via austin-group-l at The Open Group
    • Re: Is strnlen... Joseph Myers via austin-group-l at The Open Group

Reply via email to