From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20938 invoked by alias); 18 Oct 2007 17:45:34 -0000 Received: (qmail 20928 invoked by uid 22791); 18 Oct 2007 17:45:33 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 18 Oct 2007 17:45:29 +0000 Received: from zps36.corp.google.com (zps36.corp.google.com [172.25.146.36]) by smtp-out.google.com with ESMTP id l9IHjL2O015648 for ; Thu, 18 Oct 2007 18:45:21 +0100 Received: from ug-out-1314.google.com (ugcm2.prod.google.com [10.66.114.2]) by zps36.corp.google.com with ESMTP id l9IHjJvu010122 for ; Thu, 18 Oct 2007 10:45:20 -0700 Received: by ug-out-1314.google.com with SMTP id m2so513194ugc for ; Thu, 18 Oct 2007 10:45:19 -0700 (PDT) Received: by 10.67.24.11 with SMTP id b11mr2096150ugj.1192729514927; Thu, 18 Oct 2007 10:45:14 -0700 (PDT) Received: by 10.66.242.13 with HTTP; Thu, 18 Oct 2007 10:45:14 -0700 (PDT) Message-ID: Date: Thu, 18 Oct 2007 17:45:00 -0000 From: "Douglas Evans" To: "Douglas Evans" , "Paul Hilfinger" , gdb@sourceware.org Subject: Re: print/x on references In-Reply-To: <20071018171114.GA21738@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20071018093736.8076A48CB9C@nile.gnat.com> <20071018111644.GA32574@caradoc.them.org> <20071018163012.GA19490@caradoc.them.org> <20071018171114.GA21738@caradoc.them.org> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-10/txt/msg00151.txt.bz2 On 10/18/07, Daniel Jacobowitz wrote: > On Thu, Oct 18, 2007 at 10:03:01AM -0700, Douglas Evans wrote: > > To find the address of the pointer to the object I was thinking "p > > &(&x)". It works, at least in the simple example I used to experiment > > with. > > That is such a horrible abuse of C++ that I didn't even think to try > it. Egads. Not quite sure how I feel about that! fwiw, I think the expression evaluator should work as the language does (as much as possible). And once it does that then thought is given to whatever extensions are needed to accomplish things not possible with the language syntax. e.g. "p cut-n-pasted-expression-from-source" should "just work" (to some reasonable extent). Given that, to me "p &cref" -> (c*) and not (c**) follows naturally out of c++ syntax. Whatever goop we want to add to get at the address of the object containing the reference is separate. "p &(&cref)" is the first thing that came to mind and wonderfully it "just worked". One may want a different (or additional) way to achieve this of course, but it should not break "p &cref" -> (c*). fwiw of course.