Array of functions [repost]

Walter Murray walter at hpclwjm.HP.COM
Tue Nov 28 04:27:59 AEST 1989


Norman Diamond writes:

> I wrote:

>>> Section 3.5.4.2 does not attempt to prohibit a declaration of the form
>>>   extern int f[3]();  /* array of 3 functions, each returning int */
>>> What shall be the meaning of such a declaration?

> In article <12570033 at hpclwjm.HP.COM> walter at hpclwjm.HP.COM (Walter Murray) writes:

>>Behavior is undefined because it's an erroneous program construct.
>>Section 3.1.2.5 disallows arrays of functions.

> OK, I have read section 3.1.2.5 three more times.  Where does it
> disallow arrays of functions?  Page number and line number please.

>From the December 7, 1988, dpANS:

Page 24, lines 23-24:

   "An array type describes a contiguously allocated nonempty set of
   objects with a particular member object type, called the element
   type."

The key word is "object".  A function is not an object.

Page 23, lines 27-30:

   "Types are partitioned into object types (types that describe
   objects), function types (types that describe functions), and
   incomplete types (types that describe objects but lack information
   needed to determine their sizes)."

Walter Murray
---



More information about the Comp.std.c mailing list