PATCH] Improve performance of memmem

Eric Blake eblake@redhat.com
Wed Dec 19 15:26:00 GMT 2018


On 12/19/18 6:57 AM, Wilco Dijkstra wrote:

> Indeed, and in actual expressions I think it would be better to write:
> 
> sizeof (var) + 1
> 
> rather than
> 
> sizeof var + 1

Or use the commutative rule:

1 + sizeof var

> 
> and assuming everybody knows the C operator precedence table...

Indeed, but it's also quite rare to need either (sizeof var) + 1 or 
sizeof (var + 1), so the issue doesn't come up much in practice.  In 
that case, you are right that explicit parens help clarify intent 
precisely because it is uncommon.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



More information about the Newlib mailing list