Re: PATCH] Improve performance of memmem

Wilco Dijkstra <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <DB5PR08MB103027509CBD686F1E75D25F83BE0@DB5PR08MB1030.eurprd08.prod.outlook.com>
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
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.