Assignment to pointers to functions returning void

Joe joe at teltone.UUCP
Sat Mar 3 04:54:01 AEST 1984


This may not be news to you but it was news to me.  The 4.1 BSD C
complier barfs when an attempt is made to assign the address of a
function returning void to a variable declared as a pointer to a
function returning void.  Example code can be found below.  Can
I say that the compilier voids on voids or should I send this line
to net.jokes.  Enjoy. 

Joe Brady  ..!uw-beaver!teltone!joe.
==================================================================
/* Program demonstrates a bug in the VAX 4.1 BSD C compilier.
 * The following error messages is printed:
 * "junk.c", line 17: operands of = have incompatible types
 */
short 	f0();
void 	f1();
int 	f2();

main()
{
    short 	(*pf0)(); 
    void 	(*pf1)();
    int 	(*pf2)();

    pf0 = f0;
    pf1 = f1;			/* This is line 17 */
    pf2 = f2;
}



More information about the Comp.lang.c mailing list