[comp.std.c] Array of functions

diamond@csl.sony.co.jp (Norman Diamond) (11/17/89)

Section 3.5.4.3 very carefully prohibits a declaration of the form
  extern int f()[3];  /* function returning array of 3 integers */

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?

-- 
Norman Diamond, Sony Corp. (diamond%ws.sony.junet@uunet.uu.net seems to work)
  Should the preceding opinions be caught or     |  James Bond asked his
  killed, the sender will disavow all knowledge  |  ATT rep for a source
  of their activities or whereabouts.            |  licence to "kill".

walter@hpclwjm.HP.COM (Walter Murray) (11/21/89)

Norman Diamond writes:

> 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?

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

Walter Murray
----------

diamond@csl.sony.co.jp (Norman Diamond) (11/24/89)

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@hpclwjm.HP.COM> walter@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.

Incidentally, I have not yet read enough to see if arrays of functions
(function definitions) are prohibited, but for the time being will
trust it.  That's why my example declares an external reference to
an array of functions (which could be defined in PL/I or assembly for
example).  But in sections 3.1.2.5 and 3.5.4.2, I cannot find any sort
of prohibition against either of these.

-- 
Norman Diamond, Sony Corp. (diamond%ws.sony.junet@uunet.uu.net seems to work)
  Should the preceding opinions be caught or     |  James Bond asked his
  killed, the sender will disavow all knowledge  |  ATT rep for a source
  of their activities or whereabouts.            |  licence to "kill".