Composite type formation question

J. Stephen Adamczyk jsa at edg1.UUCP
Tue Feb 12 10:02:59 AEST 1991


Consider this example:

int f(int (*)[]);
int f(a)
int (*a)[3];
{
  return sizeof(*a);
}

I believe the two function types are compatible.  I also believe that a
composite type should be formed.  3.1.2.6 says

"If only one type is a function type with a parameter type list (a function
prototype), the composite type is a function prototype with the parameter
type list."

I believe the second type (in the function definition) does not have
a "parameter type list," so the above seems to suggest that the composite
should just be the type

int f(int (*)[])

taking the parameter type list from the prototyped type.  Is that right?
If that's the case, does that mean that the sizeof is illegal?


Steve Adamczyk (jsa at edg.com or uunet!edg1!jsa; 201-744-2620)



More information about the Comp.std.c mailing list