[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL)
From: |
Dave Dodge |
Subject: |
Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL) |
Date: |
Tue, 19 Sep 2006 00:36:10 -0400 |
User-agent: |
Mutt/1.4.2i |
On Sun, Sep 17, 2006 at 10:45:06PM -0500, Cayle Graumann wrote:
> On 9/17/06, Daniel Glöckner <address@hidden> wrote:
> Adding the extra set of parentheses in the define was the solution I
> came up with to get it to compile also. The real question is why does GCC
> allow it?
Because the grammar makes it unambiguous. The parentheses are not
supposed to be needed:
sizeof (x)/sizeof (x)[0]
The [0] can only be applied to a postfix-expression. None of these is
a postfix-expression:
sizeof (x)/sizeof (x) multiplicative-expression
(x)/sizeof (x) multiplicative-expression
sizeof (x) unary-expression
The only way it parses is:
(x) primary-expression
^^^[0] postfix-expression
sizeof ^^^^^^ unary-expression
(x) primary-expression
sizeof ^^^ unary-expression
^^^^^^^^^^/^^^^^^^^^^^^^ multiplicative-expression
Which is what the code intends.
> >But then we can go further and ask if "sizeof (char)7" is a legal C
> >expression...
No, that's always an error. For example:
char type-name
(^^^^)7 cast-expression
sizeof ^^^^^^^ error: sizeof can't be applied to a cast-expression
or
char type-name
sizeof (^^^^) unary-expression
^^^^^^^^^^^^^7 error: unary-expression followed by constant
-Dave Dodge
- Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL) [PATCH], (continued)
- Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL) [PATCH], Rob Landley, 2006/09/13
- Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL), Daniel Glöckner, 2006/09/13
- Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL), Cayle Graumann, 2006/09/15
- Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL), Daniel Glöckner, 2006/09/16
- Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL), Cayle Graumann, 2006/09/17
- Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL), Daniel Glöckner, 2006/09/17
- Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL), Cayle Graumann, 2006/09/17
- Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL), Cayle Graumann, 2006/09/18
- Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL), Daniel Glöckner, 2006/09/18
- Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL), Cayle Graumann, 2006/09/19
- Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL),
Dave Dodge <=
- [Tinycc-devel] Re: sizeof parsing, Daniel Glöckner, 2006/09/19
- Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL), Cayle Graumann, 2006/09/19
Re: [Tinycc-devel] TCC on new ARM EABI (ARMEL), Alexander Shishkin, 2006/09/08