typedef name question

Michael Gong mwgong@cs.utoronto.ca
Mon Jan 22 01:55:00 GMT 2007


Hi, gcc developers,

I have 2 following programs, and both are compiled fine by gcc:

/* t1.c */
typedef int myint;
int foo() {
    int myint;
    myint * myint;     /* an expression: variable "myint" * "myint" */
}

/* t2.c */
typedef int myint;
int foo() {
      myint * myint; /* a declaration for pointer variable "myint" */
}

As you can see, the "myint * myint" could have different interperation 
depending on previous declarations. I am wondering how gcc distinguish 
them ? Is it done during parsing step or during semantic checking step ?

Thanks.

Mike



More information about the Gcc-help mailing list