Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site tymix.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!vax135!cornell!uw-beaver!tektronix!hplabs!oliveb!tymix!kanner From: kanner@tymix.UUCP (Herb Kanner) Newsgroups: net.unix,net.bugs.4bsd Subject: Re: Compiler bug Message-ID: <415@tymix.UUCP> Date: Thu, 9-May-85 21:21:31 EDT Article-I.D.: tymix.415 Posted: Thu May 9 21:21:31 1985 Date-Received: Fri, 17-May-85 01:18:38 EDT References: <1136@sjuvax.UUCP> Reply-To: kanner@tymix.UUCP (Herb Kanner) Distribution: net Organization: Tymnet Inc., Cupertino CA Lines: 26 Xref: watmath net.unix:4526 net.bugs.4bsd:1525 Summary: In article <1136@sjuvax.UUCP> jss@sjuvax.UUCP (J. Shapiro) writes: >I recently noticed that the following will not compile correctly on a >4.2 BSD system: > >extern int usr1(), usr2(), usr3(); > >int usrprocs[] = { usr1, usr2, usr3 } > >whereas it compiles correctly on intel machines, cromix, and Aztec C. >It seems to me that this is something the linker should be able to handle >correctly, and therefore should not be a bug. > You want to use extern int usr1(), usr2(), usr3(); int (*usrprocs[])() = { usr1, usr2, usr3 }; The call is written as (*usrprocs[i])() and can even have parameters, e.g. (*usrprocs[i])(a, b, c) provided the number and types of the parameters are identical for all three functions. -- Herb Kanner Tymnet, Inc.