[TUHS] v7 K&R C

Noel Chiappa jnc at mercury.lcs.mit.edu
Tue Apr 28 03:45:53 AEST 2020


    > From: Derek Fawcus

    > I think he means something like:
    >    (*((*((*((*f)()->g))()->h))()->i))()

So I've been confused by this thread, and I'm hoping someone can deconfuse me
- but I think I may have figured it out.

What's confusing me is that in C, the -> operator is followed by "an
identifier [which] designates a member of a structure or union object" (I
checked the spec to make sure my memory hadn't dropped any bits) - but g, h
above are arguments; so I couldn't figure out what was going on.

I think what may have happened is that initially the discussion was about C
("Pretty sure it was not in v7 C"), but then it switched to C++ - with which
I'm not familiar, hence my confusion - without explicitly indicating that
change (although the reference to Bjarne Stroustrup should been a clue). (And
that's why I thought "f()->g()->h()->i()" was ad hoc notation for "calls f(),
then calls g()".)

Am I tracking now?

    Noel




More information about the TUHS mailing list