Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!ames!ptsfa!hoptoad!academ!killer!jfh From: jfh@killer.UUCP (John Haugh) Newsgroups: comp.lang.c Subject: Re: Another portable code question Message-ID: <1019@killer.UUCP> Date: Fri, 19-Jun-87 13:13:44 EDT Article-I.D.: killer.1019 Posted: Fri Jun 19 13:13:44 1987 Date-Received: Thu, 25-Jun-87 06:40:23 EDT References: <16673@cca.CCA.COM> <1763@ttrdc.UUCP> <16769@cca.CCA.COM> Organization: The Unix(tm) Connection, Dallas, Texas Lines: 40 Summary: Wrong usage. In article <16769@cca.CCA.COM>, g-rh@cca.CCA.COM (Richard Harter) writes: > In article <1763@ttrdc.UUCP> levy@ttrdc.UUCP (Daniel R. Levy) writes: > >< .... > >< (*command)(args); > >< .... > > As I recall, the warning was to the effect that the * was not > needed. As to lint. I trimmed the code -- the actual statement was > of the for 'value = (*command)(args))'... Sorry if this has been said this week, I said it a few weeks back. Function declarations are wierd in C. The only language that seems to get pointers reasonably normal (or non-wierd) is BLISS. But then I hate all of those silly little dots. [ This is just inews fodder ] Heres the short form on function declarations. Write Dennis if you want more, or better still go buy the book. int func(); /* function returning integer */ int *func(); /* function returning pointer to integer */ int (*func)(); /* pointer to function returning integer */ int *(*func)(); /* pointer to function returning * to int */ How do you use these guys to get an integer after you call them? i = func (); /* returns integer, use that */ i = *(func ()); /* returns pointer, dereference it */ i = (func) (); /* use pointer, take return value */ i = *((func) ()); /* use pointer, dereference return value */ There it is in a nutshell, you really don't need the * unless the function is declared int (**func)();, then you have pointer to pointer to a function returning an integer. > Richard Harter, SMDS Inc. [Disclaimers not permitted by company policy.] - John. Disclaimer: No disclaimer. Whatcha gonna do, sue me?