[TUHS] v7 K&R C
Noel Hunt
noel.hunt at gmail.com
Mon Apr 27 08:38:39 AEST 2020
Tom Cargill makes (made) frequent use of this construction in 'pi'
(process inspector, first in Eight Edition), e.g.,
asm.c: _asm->core->process()->openmemory(addr);
frame.c: return core->process()->frame(level-1)->regloc((int)v->range.lo,
v->type.size_of());
phrase.c: frame->symtab()->core()->process()->openmemory(expr->val.lng);
On Mon, Apr 27, 2020 at 6:11 AM Derek Fawcus <
dfawcus+lists-tuhs at employees.org> wrote:
> On Sun, Apr 26, 2020 at 08:37:04PM +0100, Derek Fawcus wrote:
> > 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.
>
> Actually trying it, while the above does the right thing,
> I can also get the following to compile with a modern compiler
>
> (*(*(*(*f)()->g)()->h)()->i)();
>
> So maybe that was the answer?
>
> I guess I'd have to question why someone would wish to write
> such a construct, as error handling seems awkward. Even in
> the modern form.
>
> DF
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20200427/99797b10/attachment.html>
More information about the TUHS
mailing list