Interpretation needed Re: function prototypes (LONG)

Walter Murray walter at hpclwjm.HP.COM
Tue Jul 11 10:19:02 AEST 1989


Kathy Harris writes:

> I'm still not clear on this.  Is it only the "top-level" qualifier that
> is to be ignored for comparisons, or all qualifiers.

Only the "top-level" qualifier, as you call it.  This gets into
the concept of "top type", or "type category" as it is now called.
(See 3.1.2.5.)  I think the key statement is, "A derived type
is not qualified by the qualifiers (if any) of the type from which it
is derived."  Page 25, line 22, 12/88 dpANS.  For example,
"int * const p" is a qualified type, but "const int * p" is not, if
I have it right.

> For example, are
> the following compatible or not:

> 	int f(const int * p);
> 	int f(int * p);

> where the 'const' qualifier applies to the 'int' not to the 'pointer'.

These are *NOT* compatible.  But the following *ARE* compatible:

	 int f(int * const p);
	 int f(int * p);

I hope someone who understands "top type" will confirm my understanding
on this, or straighten me out.

> Kathy Harris

Walter Murray

Not speaking for X3J11 or Hewlett-Packard.
----------



More information about the Comp.std.c mailing list