Re: PATCH] Improve performance of memmem

Eric Blake <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.