Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!uakari.primate.wisc.edu!aplcen!ginosko!uunet!sdrc!scjones From: scjones@sdrc.UUCP (Larry Jones) Newsgroups: comp.lang.c Subject: Re: Pointers to functions on Xenix Message-ID: <794@sdrc.UUCP> Date: 8 Sep 89 21:45:57 GMT References: <1989Sep8.021802.29203@Octopus.COM> Organization: Structural Dynamics Research Corp., Cincinnati Lines: 24 In article <1989Sep8.021802.29203@Octopus.COM>, stever@Octopus.COM (Steve Resnick ) writes: > my problem is that the Xenix C compiler bitches at using pointers to > functions. For example, consider the follow fragment... > (Cmds[idx].fptr)(c,v); /* Here is where I call the function */ > > This is what the compiler doesn't like. The error message is something like > > Term does not evaluate to a function. The error message says it all -- (Cmds[idx].fptr) is not a function, it's a POINTER to a function. You need to use (*Cmds[idx].fptr) for many existing implementations, although ANSI C allows as few or as many asterisks as you like. Once again, let's all repeat in unison: In C, the use of a variable and it's declaration should look the same. ---- Larry Jones UUCP: uunet!sdrc!scjones SDRC scjones@SDRC.UU.NET 2000 Eastman Dr. BIX: ltl Milford, OH 45150-2789 AT&T: (513) 576-2070 "I have plenty of good sense. I just choose to ignore it." -Calvin