From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8048 invoked by alias); 1 Aug 2005 04:13:17 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 7878 invoked by uid 22791); 1 Aug 2005 04:13:00 -0000 Received: from h-68-164-203-246.nycmny83.covad.net (HELO dberlin.org) (68.164.203.246) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 01 Aug 2005 04:13:00 +0000 Received: from [127.0.0.1] (HELO localhost) by dberlin.org (CommuniGate Pro SMTP 4.3.6) with ESMTP id 8060578; Mon, 01 Aug 2005 00:12:59 -0400 Subject: Re: Is is possible to use the name of a variable in the constructor? From: Daniel Berlin To: Ian Lance Taylor Cc: Gunther Piez , gcc-help@gcc.gnu.org In-Reply-To: References: <200508010155.53152.gpiez@web.de> <200508010232.22389.gpiez@web.de> Content-Type: text/plain Date: Mon, 01 Aug 2005 04:13:00 -0000 Message-Id: <1122869578.32467.102.camel@linux.site> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2005-08/txt/msg00003.txt.bz2 On Sun, 2005-07-31 at 19:53 -0700, Ian Lance Taylor wrote: > Gunther Piez writes: > > > Am Montag, 1. August 2005 02:04 schrieb Ian Lance Taylor: > > > Gunther Piez writes: > > > > struct uniform { > > > > uniform() { > > > > cout << "A variable called " << __PRETTY_VARNAME__ << " was just > > > > instantinated (sp)" << endl; > > > > } > > > > }; > > ... > > > Maybe it is possible to use the debugging information somehow? At least the > > debugger usually knows the names of variables. > > Maybe it is possible, but nothing straightforward comes to mind. You still have the issue that you need to have all the *actual* callers in front of you, so you'd have to process debug info on the fly if you were dlopen'ing stuff like plugins. > Remember that the debugger doesn't know the name within > uniform::uniform. It only knows the name if you go up the stack frame > to the caller. > > Ian