Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!wuarchive!uunet!sdrc!thor!scjones From: scjones@thor.UUCP (Larry Jones) Newsgroups: comp.lang.c Subject: Re: Functions within structures Keywords: structures Message-ID: <203@thor.UUCP> Date: 14 Nov 90 01:04:34 GMT References: <2203@abcom.ATT.COM> <1990Nov10.155153.20639@chinet.chi.il.us> <14431@smoke.brl.mil> Organization: SDRC, Cincinnati Lines: 26 In article <14431@smoke.brl.mil>, gwyn@smoke.brl.mil (Doug Gwyn) writes: > [ about whether "(*pf)() or (pf)() is more correct ] > > Actually the second one is more "theoretically" correct. The function > designator in the first expression is automatically converted to a > pointer to the function; the second form is already that way. That depends on which theory you subscribe to. In classic C, you called a function -- there was no automatic conversion to a pointer -- and the first form was thus "theoretically" correct. The second form was, at least for some compilers, "completely" wrong -- they refused to generate code when presented with that construct. Of course, we all know that you use the address to call a function so it makes much more sense to say that a call is made using a pointer to the function and having the name of a function decay into a function pointer like the name of an array decays into a pointer to the first element. That's precisely what X3J11 did, although both decays were generalize to expressions of the specified type rather than special casing names. ---- Larry Jones UUCP: uunet!sdrc!thor!scjones SDRC scjones@thor.UUCP 2000 Eastman Dr. BIX: ltl Milford, OH 45150-2789 AT&T: (513) 576-2070 Don't you hate it when your boogers freeze? -- Calvin