[PATCH] manual: Update memchr description [BZ #19406]

Paul Eggert eggert@cs.ucla.edu
Mon Jun 15 22:26:35 GMT 2026


On 2026-06-15 09:26, Wilco Dijkstra wrote:
> +This function behaves as if each byte is read sequentially and stops as
> +soon as the first match is found.  @var{size} may be larger than the object
> +starting at @var{block} if there is a match within the object.

This behavior guarantee applies to memchr but not to 
memcmp/wmemchr/etc., and that should probably be documented. Also, "is 
read" clashes with "stops". Something like the following instead, perhaps?

---

This function behaves as if it reads the bytes sequentially and stops at 
the first match, which means that if the object contains a match the 
behavior is defined even when the object size is less than @var{size}. 
This behavior guarantee is unusual, and is not shared by related 
functions like @code{memcmp} and @code{wmemchr}.


More information about the Libc-alpha mailing list