forward declaration of array; how?

Richard O'Keefe ok at cs.mu.oz.au
Thu Oct 12 13:21:52 AEST 1989


In article <2364 at munnari.oz.au> ok at cs.mu.oz.au (Richard O'Keefe) writes:
>	extern void (*(dispatch[]))();
>	static void (*(dispatch[]))() = { ... foo, ..., baz, ... };
In article <14868 at haddock.ima.isc.com>, karl at haddock.ima.isc.com (Karl Heuer) writes:

: The ANSI way to do this is to use `static' rather than `extern' in the first
: declaration.

I received E-mail from two other people suggesting this.
It's obvious enough, in all conscience, to make the two declarations
agree about the storage class.  The trouble is that the nearest thing
to an ANSI compiler available to me is gcc 1.36, which doesn't like it.
As the man says:

: Unfortunately, not all existing pre-ANSI compilers agree with this.

Oh well, I should have known I was asking for trouble when I had to use
the extern/static hack to make the PDP-11 compiler happy way back when.



More information about the Comp.lang.c mailing list