S
stephenfsiegel
I'm confused about something in the C11 Standard. In Section 6.2.7 "Compatible type and composite type", item (4) states:
"For an identifier with internal or external linkage declared in a scope inwhich a prior declaration of that identifier is visible, if the prior declaration specifies internal or external linkage, the type of the identifier at the later declaration becomes the composite type."
Immediately after this, in item (5), the following example appears:
--- begin example ---
Given the following two file scope declarations:
int f(int (*)(), double (*)[3]);
int f(int (*)(char *), double (*)[]);
The resulting composite type for the function is:
int f(int (*)(char *), double (*)[3]);
--- end example ---
However, the second declaration of f occurs in a scope in which a prior declaration of f (namely, the first declaration) is visible, and both declarations specify external linkage (see Sec. 6.2.2, in particular "If the declaration of an identifier for a function has no storage-class specifier, its linkage is determined exactly as if it were declared with the storage-class specifier extern."). Therefore, according to (4), the composite type should be the type at the second declaration, not "int f(int (*)(char *), double(*)[3]);".
What am I missing?
Thanks.
"For an identifier with internal or external linkage declared in a scope inwhich a prior declaration of that identifier is visible, if the prior declaration specifies internal or external linkage, the type of the identifier at the later declaration becomes the composite type."
Immediately after this, in item (5), the following example appears:
--- begin example ---
Given the following two file scope declarations:
int f(int (*)(), double (*)[3]);
int f(int (*)(char *), double (*)[]);
The resulting composite type for the function is:
int f(int (*)(char *), double (*)[3]);
--- end example ---
However, the second declaration of f occurs in a scope in which a prior declaration of f (namely, the first declaration) is visible, and both declarations specify external linkage (see Sec. 6.2.2, in particular "If the declaration of an identifier for a function has no storage-class specifier, its linkage is determined exactly as if it were declared with the storage-class specifier extern."). Therefore, according to (4), the composite type should be the type at the second declaration, not "int f(int (*)(char *), double(*)[3]);".
What am I missing?
Thanks.