[cfe-dev] Better type-specifier representation

Argiris Kirtzidis akyrtzi at gmail.com
Fri Sep 12 15:13:59 PDT 2008


steve naroff wrote:
> All good points...
>
> Sometimes it's useful to consult the spec to help weigh various design 
> points.
>
> That said, C99 6.7.2.3p3 says...
>
> All declarations of structure, union, or enumerated types that have 
> the same scope and 
> use the same tag declare the same type. The type is incomplete109) 
> until the closing brace 
> of the list deļ¬ning the content, and complete thereafter. 
>
> Since both x and y have the same type, I don't see any compelling 
> reason to alter the type system.
>
> struct S{} x;
> struct S y;

C99 6.7.7p7 says:
All three of the following declarations of the signal function specify 
exactly the same type

typedef void fv(int), (*pfv)(int);
void (*signal(int, void (*)(int)))(int);
fv *signal(int, fv *);
pfv signal(int, pfv);

And we don't actually use "exactly the same type", we use TypedefType to 
capture more syntactic information.

>
> From my perspective, we need to have a compelling reason to fold this 
> into the type system.
>
> If not, I think the DeclGroup solution will work fine (and appears 
> simpler).

See here:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-September/002807.html
about why I think folding it in the type is simpler.

-Argiris



More information about the cfe-dev mailing list