[net.lang.c] parens on sizeof

davidt@ttidca.UUCP (David Terlinden) (03/20/85)

The empty string is an expression.  Therefore "sizeof (int)" is the
empty expression cast to type "integer" and an expression.  Therefore
"sizeof (int)" is of the form sizeof <expression> .

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (03/20/85)

> The empty string is an expression.

I bet Ritchie would be surprised to learn that.

ron@brl-tgr.ARPA (Ron Natalie <ron>) (03/20/85)

> > The empty string is an expression.
> 
> I bet Ritchie would be surprised to learn that.

Yeah, then it's obviously a bug that my compiler won't let me
do
	a = (int);

According to the K&R:

	Statement = ;
		    expr ;
		... list of things like while, if etc...

	Expression =   primary
		       unary expression
		...list of things, non of which are null...

	unary-expression:
		... all the others...
		(type-name) expression
		sizeof expression
		sizeof (type-name)

-Ron

ndiamond@watdaisy.UUCP (Norman Diamond) (03/21/85)

> The empty string is an expression.  Therefore "sizeof (int)" is the
> empty expression cast to type "integer" and an expression.  Therefore
> "sizeof (int)" is of the form sizeof <expression> .

sizeof (int) ""     would be     sizeof <expression>

Whitespace is not equivalent to the empty string.  I'd sure hate for
a = *b;    to be interpreted as     a = ""*b;

-- 

   Norman Diamond

UUCP:  {decvax|utzoo|ihnp4|allegra}!watmath!watdaisy!ndiamond
CSNET: ndiamond%watdaisy@waterloo.csnet
ARPA:  ndiamond%watdaisy%waterloo.csnet@csnet-relay.arpa

"Opinions are those of the keyboard, and do not reflect on me or higher-ups."