This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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]

Fw: typedef name question


Any comments are welcomed.

Thanks.

Mike

----- Original Message ----- From: "Michael Gong" <mwgong@cs.toronto.edu>
To: <gcc-help@gcc.gnu.org>
Sent: Sunday, January 21, 2007 8:55 PM
Subject: typedef name question



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




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