Safe-dereference operator?
Frank Ch. Eigler
fche@redhat.com
Tue Aug 18 23:04:19 GMT 2020
craig wrote:
> TL;DR: Proposal to add a safe-dereference pseudo-operator like Groovy's ?.
> to the language to simplify chasing pointer chains.
> ?. is basically an abbreviated ternary without the multiple-evaluation
> hazard:
> a ?. b ?. c
This sounds like something that can be done via a macro
(tapset/SOMETHING.stpm) with a functional syntax, if you
can accept the multiple-evaluation problem:
@define pointer_chase_1(a,b) %( @a ? @a->@b : 0 %)
@define pointer_chase_2(a,b,c) %( @a ? (@a->@b ? @a->@b->@c : 0) : 0 %)
If you can't ... can you explain why? Must those index
fields depend on state-modifying calculations?
- FChE
More information about the Systemtap
mailing list