Interpretation needed Re: function prototypes (LONG)

Shankar Unni shankar at hpclscu.HP.COM
Sat Jul 8 09:14:53 AEST 1989


Thanx, all, for the replies. It's a little clearer now. Dave, you're right:
I was getting a little confused re: composite types and qualifiers. You
see, on the one hand, section 3.1.2.6 states (third bullet) that the
composite type of two function types with parameter lists is a function
type with a parameter list, with the type of each parameter being the
composite type of the corresponding parameters from the two function types.

On the other hand, if one has a parameter of type "const int", and the other
has a parameter of type "int", clearly there is no "composite type" of
these two types (via sec. 3.5.3).

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.
----
Shankar.



More information about the Comp.std.c mailing list