Shouldn't this work?

Larry West west at sdcsla.UUCP
Sat Aug 25 09:26:03 AEST 1984

Yes, it should, and it probably is a problem with the 4.2bsd compiler.
Try this fragment for fun:

	extern void *beep();
	void (*funk)() = (void (*)()) beep;
	main () {}

When used in this skeleton form, "cc" ("ld") only complained that "beep"
was undefined, and "lint" only said that "funk" was defined but never used.

[The original article had declared "extern void beep()", and used it
 in an equivalent structure initialization].

I don't know what "void *" >means<, nor why it is type-compatible in this
case, but there it is.   Example tried on Sun-2 and Vax.   Long live 4.2bsd.

	-- Larry West, UC San Diego, Institute for Cognitive Science
	-- decvax!ittvax!dcdwest!sdcsvax!sdcsla!west
	-- ucbvax!sdcsvax!sdcsla!west
	-- west at NPRDC

More information about the Comp.lang.c mailing list