parens around sizeof arg

cottrell at nbs-vms.ARPA cottrell at nbs-vms.ARPA
Wed Feb 6 06:47:09 AEST 1985


/*
> > (Hey, (guys), let's (not) put extra (parentheses (everywhere)))!
> > sizeof thing
> > sizeof(type)
> 
> Strictly speaking, that is correct syntax.  Still, C allows one to
> parenthesise any expression.  Because "operators" like 'sizeof' and
> 'return' are made up of letters, I like to put their operands in
> parentheses.  Purely visual (not even syntactic) sugar.		;-)
> 
> Joe Yao		hadron!jsdy at seismo.{ARPA,UUCP}

I have to agree with Joe here. I think of sizeof as a compile-time
funxion. Thus the args. Purely style. I always write `if (exp)' &
`while (exp)' but always `return(exp)'. Unless I am cheating, as in

	if (exp)			if (exp) {
		return exp;			exp;
						return;
					}

The example on the left avoids the braces while semi-documenting
the fact that. I know, you are shocked! I'm just a bad guy.
*/



More information about the Comp.lang.c mailing list