Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!hsdndev!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.c Subject: Re: Invoking pointers to functions (C sytle) Message-ID: <4746:Dec423:07:3390@kramden.acf.nyu.edu> Date: 4 Dec 90 23:07:33 GMT References: <6379@harrier.ukc.ac.uk> <1990Dec02.204212.15465@slate.mines.colorado.edu> <989@mwtech.UUCP> Organization: IR Lines: 23 In article <989@mwtech.UUCP> martin@mwtech.UUCP (Martin Weitzel) writes: [ usage should be absolutely symmetric to declaration ] Agreed. [ in ANSI C, if foo points to a function, you can call foo(x) ] [ this breaks symmetry ] Agreed. [ therefore only (*foo)(x) should be allowed ] Well, that's one solution, but this one is more natural: The name of a function has type ``pointer to function.'' So after int foo() { ... }, the object ``foo'' refers to has type pointer-to-function-returning-int. And all functions are called through function pointers. Symmetry is preserved. Why is this more natural? Because it's how the machine does it. In the absence of any other criteria, the realistic solution is the natural one. ---Dan Brought to you by Super Global Mega Corp .com