4.2 C bugs?

Norman Diamond ndiamond at watdaisy.UUCP
Tue Mar 5 03:56:07 AEST 1985


>    1)  The C compiler (4.2bsd) barfs on the following:
> 	void foo() {...}
> 	void blort() {...}
> 	void (*f[]) () = {
> 		foo,			/* Operands of = have incompat. types*/
> 		blort,			/* Ditto. */
> 		0
> 	}

It's true.  f /* array of pointers */ cannot be initialized to functions.
In the other cases originally cited, integers could be initialized to
pointers, but the conversion is implementation-dependent.

If you want to initialize pointers to pointers, try:

	void foo() {...}
	void blort() {...}
	void (*f[]) () = {
		&foo,
		&blort,
		0
	}

-- 

   Norman Diamond

UUCP:  {decvax|utzoo|ihnp4|allegra}!watmath!watdaisy!ndiamond
CSNET: ndiamond%watdaisy at waterloo.csnet
ARPA:  ndiamond%watdaisy%waterloo.csnet at csnet-relay.arpa

"Opinions are those of the keyboard, and do not reflect on me or higher-ups."



More information about the Comp.lang.c mailing list