Function Calls

Richard Draves draves at harvard.ARPA
Thu Dec 13 08:08:44 AEST 1984


Which usage is correct:

extern int (*a)();

extern int b();

main()
{
	a = b;		/* b's type promoted to pointer to function ... */

	(*a)();		/* a legal function call */
	b();		/* also legal */
	a();		/* not legal, but often accepted */

	(b)();		/* the question:  which of these is correct? */
	(*b)();
}

Any compiler that accepts "(*b)()" and "a()" will probably
also accept "(b)()".  Our 4.2BSD cc accepts all three,
and also "(**b)()", etc.

Rich



More information about the Comp.lang.c mailing list