[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] Type names as identifiers
From: |
Alex Measday |
Subject: |
[Tinycc-devel] Type names as identifiers |
Date: |
Tue, 27 May 2003 14:50:24 -0400 |
TCC reports an error when a type name is used as a field name
in a structure. I try to avoid this practice in my own code,
but I'm encountering it in some automatically generated C
code. In this case, an enumeration type is declared and
its name is later used as a field name in a structure.
Here's a simple test program:
typedef enum ABC {
A, B, C
} ABC ;
typedef struct XYZ {
int ABC ; <<<==== error here!
} XYZ ;
int main (int argc, char *argv[])
{
XYZ xyz ;
xyz.ABC = 1 ;
return (0) ;
}
TCC reports: "test.c:6: identifier expected"; GCC compiles it without
error. ISO C99, Section 6.2.3, #1 seems to allow it when it says "each
structure or union has a separate name space for its members".
Thanks,
Alex
Happy TCC User
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Tinycc-devel] Type names as identifiers,
Alex Measday <=