[TUHS] v7 K&R C

arnold at skeeve.com arnold at skeeve.com
Sun Apr 26 16:40:58 AEST 2020


"Brian L. Stuart" <blstuart at bellsouth.net> wrote:

>  On Saturday, April 25, 2020, 09:52:45 AM EDT, Hellwig Geisse <hellwig.geisse at mni.thm.de> wrote:
> > On Sa, 2020-04-25 at 09:11 -0400, Noel Chiappa wrote:
> > > Two very different things are happenging, but with the shorthand notation,
> > > they share an identical representation. And for what? To save three characters?
> > 
> > The subject can be looked at from another angle. Consider
> > the call f(42). This might be read as first naming f (and
> > thus constructing a pointer to f) and then calling the
> > function which the pointer is pointing to.
>
> This is the way that I've taken to looking at it for the
> last 10 years or so. In fact, I see it as the same thing
> as an array. Specifically, I've taken to thinking of []
> as a postfix indexing operator and () as a postfix
> calling operator, and the thing on the left is a pointer
> in both cases.
>
> BLS
>   
Algol 68 had a concept "deproceduring" similar to "dereferencing". If you
think of 

	foo(arg)

where plain "foo" is a pointer to a function and adding the parentheses
does the call, then it's the same with a procedure name or with
a function pointer.

This is pretty much what BLS said.  Thinking of [] and () as operators
is explicit in C++ (for good and for ill).

Arnold


More information about the TUHS mailing list