On 7/11/24 17:50, Eric Blake wrote:
In contrast, it's not OK to call memchr ("", 0, SIZE_MAX).
...this claim appears to be unsupported.  Both C23 and POSIX 2024
state that memchr() "...shall behave as if it reads the characters
sequentially and stops as soon as a matching character is found",

Thanks for correcting me. Evidently I was relying on old memory, as that phrase was added in C11.

In penance, I'll mention that there should be similar wording for strncmp. E.g., strncmp ("a", "b", SIZE_MAX) should be valid, although the C and POSIX standards don't make this crystal clear.

Reply via email to