This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]