HP C Programmer's Guide (92434-90009)

Chapter 5 143
Programming for Portability
Porting to ANSI Mode HP C
Figure 5-4.
These declarations show how successive levels of a type may be qualified. The declaration
for actual0 has no qualifiers. The declaration of actual1 has only the top level qualified.
The declarations of actual2 and actual3 have two and three levels qualified. When these
actual parameters are substituted into calls to the following functions:
void f0(int **formal0);
void f1(int **const formal1);
void f2(int *const *const formal2);
void f3(const int *const *const formal3);
The compatibility rules for pointer qualifiers are different for all three levels. At the first
level, the qualifiers on pointers are ignored. At the second level, the qualifiers of the formal
parameter must be a superset of those in the actual parameter. At levels three or greater
the parameters must match exactly. Substituting actual0 through actual3 into f0
through f3 results in the following compatibility matrix:
C = compatible
S = not compatible, qualifier level two of formal is not a superset of actual
parameter
N = not compatible, qualifier level three doesn't match
Table 5-1. º
f0 f1 f2 f3
actual0 CCCN
actual1 CCCN
actual2 SSCN
actual3 NS NS N C