Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: net.lang.c Subject: Re: parens around sizeof arg Message-ID: <5125@utzoo.UUCP> Date: Wed, 27-Feb-85 13:35:32 EST Article-I.D.: utzoo.5125 Posted: Wed Feb 27 13:35:32 1985 Date-Received: Wed, 27-Feb-85 13:35:32 EST References: <8048@brl-tgr.ARPA>, <607@ncoast.UUCP> Organization: U of Toronto Zoology Lines: 12 > Style for you guys, necessity for others. The only time I use sizeof is > in such expressions as, "sizeof(struct foo)"; and our compiler doesn't > realize that "struct" gets a following name, so "sizeof struct foo" gets > me a syntax error. The compiler is correct; the syntax error is real. Look carefully at the definition of sizeof: its usage is "sizeof object" or "sizeof(type)". The parentheses are *not* optional in the second case. This is part of the reason why many people put the parentheses in for all sizeofs. -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry