ILE C/C++ Language Reference
For two function types to be compatible, they must meet the following
requirements:
- They must agree in the number of parameters (and use of ellipsis).
- They must have compatible return types.
- The corresponding parameters must be compatible with the type
that results from the application of the default argument promotions.
The composite type of two function types is determined as follows:
- If one of the function types has a parameter type list, the composite
type is a function prototype with the same parameter type list.
- If both function types have parameter type lists, the composite
type of each parameter is determined as follows:
- The composite of parameters of different rank is the type that
results from the application of the default argument promotions.
- The composite of parameters with array or function type is the
adjusted type.
- The composite of parameters with qualified type is the unqualified
version of the declared type.
For example, for the following two function declarations:
int f(int (*)(), double (*)[3]);
int f(int (*)(char *), double (*)[]);
The resulting composite
type would be:
int f(int (*)(char *), double (*)[3]);
If the function declarator is not part of the function declaration,
the parameters may have incomplete type. The parameters may also specify
variable length array types by using the [*] notation in their sequences
of declarator specifiers. The following are examples of compatible
function prototype declarators:
double maximum(int n, int m, double a[n][m]);
double maximum(int n, int m, double a[*][*]);
double maximum(int n, int m, double a[ ][*]);
double maximum(int n, int m, double a[ ][m]);
Related information
[ Top of Page | Previous Page | Next Page | Contents |
Index ]