On Sun, Sep 17, 2006 at 10:45:06PM -0500, Cayle Graumann wrote: > On 9/17/06, Daniel Glöckner <[EMAIL PROTECTED]> 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 _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/tinycc-devel