tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Strange sizeof construct


From: Mike
Subject: Re: [Tinycc-devel] Strange sizeof construct
Date: Wed, 14 Nov 2007 20:39:06 -0500
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

"(arr)[0]" would be valid yes.  But "40[0]" should be invalid, right?

Chris Lattner wrote:

On Nov 14, 2007, at 5:18 PM, Mike wrote:

>>> printf("%d\n",sizeof(arr)[0]); // ok, but why?
Why should that be valid syntax?  Is C99 really weird or what?
(its a immediate value being used in place of a pointer.)

The C99 grammar says that sizeof is:

unary-expression:
  sizeof unary-expression

Why do you think it is invalid? You don't think that "(arr)[0]" is a valid expression?

-Chris


_______________________________________________
Tinycc-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/tinycc-devel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]