This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: PATCH] Improve performance of memmem
Hi,
Corinna Vinschen wrote:
> On Dec 18 14:32, Eric Blake wrote:
>> There's also the fact that:
>>
>> sizeof (int)
>>
>> has to use parenthesis; grepping for the use of () is tricky if you don't
>> filter out the uses that are for types rather than for expressions (but I
>> _do_ prefer sizeof expression over sizeof (type), which is why I prefer
>> avoiding the () to make it easier to use grep to tell the two apart).
>
> Not a fixed rule since, afaik, BSD code always uses parens in sizeof
> expressions. Apart from that I think it's a good idea to use
>
> sizeof (type)
>
> vs.
>
> sizeof var
>
> but again, there's no strong rule.
Indeed, and in actual expressions I think it would be better to write:
sizeof (var) + 1
rather than
sizeof var + 1
and assuming everybody knows the C operator precedence table...
Cheers,
Wilco