Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles; site iuvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!tektronix!hplabs!qantel!ihnp4!inuxc!iubugs!iuvax!cjl From: cjl@iuvax.UUCP Newsgroups: net.lang.c Subject: Re: Array of pointers to functions Message-ID: <9500031@iuvax.UUCP> Date: Mon, 14-Apr-86 12:14:00 EST Article-I.D.: iuvax.9500031 Posted: Mon Apr 14 12:14:00 1986 Date-Received: Sun, 20-Apr-86 16:49:19 EST References: <2398@brl-smok.UUCP> Lines: 24 Nf-ID: #R:brl-smok:-239800:iuvax:9500031:000:951 Nf-From: iuvax!cjl Apr 14 12:14:00 1986 > I'm confused. How do you specify an array of pointers to functions? Do > you do it: > int (*foo[])(); > or do you do it: > int ((*foo)())[]; If C enforces postfix notations for all its declarations, the world will be more peaceful. Two of its declarators use postfix notation ( [] and () ), while pointer uses prefix notation ( * ). Confusion about declarator precedence will disappear IF we CHANGE the syntax of pointer declarator to a postfix notation. So when we speak "an array of pointers to functions", we can write down immediately as "int foo [] * ()". To face the reality in the C world, we translate the above back into " (* (foo [])) () ". (Parentheses are used here to avoid the precedence problem.) Remembering the rule that postfix declarators has higher priority than prefix declarators, we can save some of the parentheses as " (* foo []) () ". C.J.Lo UUCP : ...!iuvax!cjl ARPA : cjl@Indiana@CSNet-Relay