parens around sizeof arg
Henry Spencer
henry at utzoo.UUCP
Thu Feb 28 04:35:32 AEST 1985
> 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
More information about the Comp.lang.c
mailing list