[PATCH] services: Fix some weird sizeof usages.

Dan Kegel dank at kegel.com
Sun Oct 21 13:27:45 CDT 2012

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

Does anybody feel strongly one way or the other?

More information about the wine-devel mailing list