Re: [RFA] Token cleanup in c-exp.y

Jiang Jilin
2009-08-25T13:45:35Z

On Tue, Aug 25, 2009 at 5:40 PM, Pierre Muller<muller@ics.u-strasbg.fr> wrote:
>   Just for information:
> doesn't this mean that
> the parser that previously accepted
>  '->  *' with spaces between the arrow and the star,
> will now reject such patterns?
>  Is this also what a C compile would do?

Personally, I think '->*' is _not_ really a single token or
operation like '++' in ISO C Standard, so the patch is _not_ correct.

>  The problem is that I have
> no idea what it stands for...
> and I never saw '->*' nor '.*' in any C sources.

Indeed, we should never see '->*' nor '.*' in C sources, you know, we
can use '->' or '.' to operate any member of a structure directly, so
why do we need '*' to dereference it?

In compiler principle, I think '->*' should result in a syntax error.

Here is a sample:

struct a {
int a;
int b;
};

int main(int argc, char **argv)
{
struct a test;
test.a = 10;

test.*a = 2;
}

$ gcc main.c
main.c: In function 'main':
main.c:10: error: expected identifier before '*' token