draves@harvard.ARPA (Richard Draves) (12/13/84)
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
ron@brl-tgr.ARPA (Ron Natalie <ron>) (12/17/84)
> 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 */ Lattice C has this sickness, I believe. > > (b)(); /* the question: which of these is correct? */ > (*b)(); > } > Well (b)() is correct if b() is correct, why should parentheses hurt you. "(*b)()" is illegal because (*b) is not a function. -Ron