Interpretation needed Re: function prototypes (LONG)

david.f.prosser dfp at cbnewsl.ATT.COM
Wed Jul 12 01:18:33 AEST 1989


In article <12570016 at hpclscu.HP.COM> shankar at hpclscu.HP.COM (Shankar Unni) writes:
>Thus, the point to be made clear, IMO, is that the "function type" really
>contains an imaginary parameter list, which is identical to the parameter
>list with which it is declared, except that the qualifiers on the parameter
>types are ignored.
>
>E.g., in the function definition
>
>   int foo (const int bar) { /* */ }
>   
>the type of "foo" is
>
>   int () (int)
>
>(my notation for: return type == int, parameter list = "int"). However, the
>type of "bar" is "const int".
>
>Am I off target? Maybe a slight clarification needs to be put into the
>standard or the rationale at some stage.

I think you've got it.  Two types must be compatible before a composite type
from the two can be attempted.  When checking whether two prototypes are
compatible, the "meaningless" type qualifiers are stripped from each parameter,
and each function or array parameter is rewritten as an appropriate pointer
type.  It is this rewritten type that must be used for the composite type
construction.

On the other hand, it doesn't matter whether the "meaningless" qualifiers are
kept in the composite type, since they are always ignored for all purposes,
except within the function definition.

At this point, I doubt that anything will be done to the Rationale or the
pANS, but the interpretations phase of the Committee must answer these sorts
of questions, but it will probably takes months...

Dave Prosser	...not an official X3J11 answer...



More information about the Comp.std.c mailing list