Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site luke.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!decwrl!glacier!oliveb!bene!luke!itkin From: itkin@luke.UUCP (Steven List) Newsgroups: net.sources.bugs Subject: Re: Call of non-function (?) Message-ID: <351@luke.UUCP> Date: Thu, 19-Dec-85 16:03:21 EST Article-I.D.: luke.351 Posted: Thu Dec 19 16:03:21 1985 Date-Received: Sat, 21-Dec-85 06:25:15 EST References: <1155@bbnccv.UUCP> Reply-To: itkin@luke.UUCP (Steven List) Followup-To: net.lang.c Distribution: net Organization: Benetics Corp, Mt.View, CA Lines: 33 In article <1155@bbnccv.UUCP> ptraynor@bbnccv.UUCP (Patrick Traynor) writes: >While trying to compile some source code that I got over the net, my compiler >tripped over this line: > >cmd->c_func(args, arg1, arg2, got1, got2); > >In fact, at several points in the code, similar lines made the compiler throw >up. The error was 'call of non-function'. I am making a couple of assumptions: cmd is a pointer to a structure AND that structure contains an element of the form: int (*c_func)(); If that is so, you've just run into something I've just finished wrestling with. The proper invocation of the function is: (*cmd->c_func)(args, arg1, arg2, got1, got2); It is important to remember that the structure element is "a pointer to a function returning an integer". Thus you must use the contents of that element, not the element, to invoke the function. The parentheses assure the proper evaluation of the statement (I tried it without and got the wrong result - it tries to take the contents of the return from the function or something). If anyone else can clarify this further, please do so. -- *** * Steven List @ Benetics Corporation, Mt. View, CA * Just part of the stock at "Uncle Bene's Farm" * {cdp,engfocus,greipa,idi,oliveb,plx,sun,tolerant}!bene!luke!itkin ***