From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id E55E83858D38 for ; Tue, 18 Aug 2020 23:04:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E55E83858D38 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-500-du6p4S0yPV2Zjt6DCbFi5w-1; Tue, 18 Aug 2020 19:04:21 -0400 X-MC-Unique: du6p4S0yPV2Zjt6DCbFi5w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 04D5E801AEA; Tue, 18 Aug 2020 23:04:21 +0000 (UTC) Received: from redhat.com (ovpn-112-64.phx2.redhat.com [10.3.112.64]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D948D5D9E2; Tue, 18 Aug 2020 23:04:20 +0000 (UTC) Received: from [127.0.0.1] (helo=vm-rhel7) by redhat.com with esmtp (Exim 4.94) (envelope-from ) id 1k8AeR-0008R7-J3; Tue, 18 Aug 2020 19:04:19 -0400 From: fche@redhat.com (Frank Ch. Eigler) To: Craig Ringer Cc: systemtap@sourceware.org Subject: Re: Safe-dereference operator? References: Date: Tue, 18 Aug 2020 19:04:19 -0400 In-Reply-To: (Craig Ringer's message of "Fri, 17 Jul 2020 11:22:32 +0800") Message-ID: <87lfibv9n0.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Aug 2020 23:04:25 -0000 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