[PATCH] services: Fix some weird sizeof usages.

Christian Costa titan.costa at gmail.com
Sun Oct 21 13:50:14 CDT 2012


Le 21/10/2012 20:27, Dan Kegel a écrit :
> Christian Costa wrote:
> ...
> --- a/programs/services/rpc.c
> +++ b/programs/services/rpc.c
> ...
> @@ -952,7 +952,7 @@ BOOL service_send_command( struct service_entry
> *service, HANDLE pipe,
>           }
>           r = GetOverlappedResult( pipe, &overlapped, &count, FALSE );
>       }
> -    if (!r || count != sizeof *result)
> +    if (!r || count != sizeof(*result))
>
> I was curious about this, so I looked around a bit.
>
> There are about 800 instances of sizeof without parens in Wine
> vs. 34628 with.
>
> I would have thought "Heck, this is just like return without
> parentheses, it emphasizes that it's not a function call,
> maybe it's a good idea."
>
> But it seems it's only legal to use it without parentheses for values;
> you need the parentheses when getting sizeof a type.  cf.
> c89: http://web.archive.org/web/20040907153347/http://danpop.home.cern.ch/danpop/ansi.c
> http://bytes.com/topic/c/answers/478596-using-sizeof-without-parentheses
> huu
> Does anybody feel strongly one way or the other?
>
>
>
Thanks for the links.  I think 800 vs 34628 should answer your question.
Anyway while I was debugging I noticed these 2 sizeof in the middle of a 
lot others with parens
and then send a patch to make them follow the file style.



More information about the wine-devel mailing list