[TUHS] v7 K&R C

Derek Fawcus dfawcus+lists-tuhs at employees.org
Mon Apr 27 05:37:04 AEST 2020


On Sat, Apr 25, 2020 at 02:03:57PM -0400, Noel Chiappa wrote:
>     > From: Rob Pike
> 
>     > To make chaining of calls simpler. Write
>     >   f()->g()->h()->i()
>     > the other way
> 
> You mean:
> 
>   (*f)((*g)((*h)((*i)())))
> 
> I dunno, it doesn't seem that much worse to me.

No, I think he means something like:

   (*((*((*((*f)()->g))()->h))()->i))()

but I can't recall the relative priority of '*' and '->' in
the above, so I may have added unnecessary parens.

Or was he thinking of having to use '.' as well to access
the member pointers within the structs?

DF


More information about the TUHS mailing list