Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: procedure pointer question Message-ID: <7108@brl-smoke.ARPA> Date: 15 Jan 88 21:11:01 GMT References: <861@xn.LL.MIT.EDU> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 25 In article <861@xn.LL.MIT.EDU> cogen@XN.LL.MIT.EDU (David Cogen) writes: >Both invocations of fun work and give the correct result. In almost all contexts, the function designator (i.e. name) is converted into a pointer to the function. When you call a function, the thing before the "(arguments)" part it is required to be a pointer to a function of appropriate type. This is what some current C compilers actually do and is what X3J11 decided on for the ANSI C standard. However, it's not how K&R described it. Note that the following invocations will all be valid and all do the same thing: extern double sin( double ); double x; x = sin( 2.0 ); x = (&sin)( 2.0 ); x = (*sin)( 2.0 ); x = (**sin)( 2.0 ); x = (***sin)( 2.0 ); /* etc. */ You can do similar things with objects that are explicit pointers- to-functions.