This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH] Improve performance of memmem


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]