From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26252 invoked by alias); 1 Aug 2005 02:54:00 -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 26236 invoked by uid 22791); 1 Aug 2005 02:53:58 -0000 Received: from yosemite.airs.com (HELO yosemite.airs.com) (205.217.158.180) by sourceware.org (qpsmtpd/0.30-dev) with SMTP; Mon, 01 Aug 2005 02:53:58 +0000 Received: (qmail 24463 invoked by uid 10); 1 Aug 2005 02:53:55 -0000 Received: (qmail 28464 invoked by uid 500); 1 Aug 2005 02:53:41 -0000 Mail-Followup-To: gcc-help@gcc.gnu.org, gpiez@web.de To: Gunther Piez Cc: gcc-help@gcc.gnu.org Subject: Re: Is is possible to use the name of a variable in the constructor? References: <200508010155.53152.gpiez@web.de> <200508010232.22389.gpiez@web.de> From: Ian Lance Taylor Date: Mon, 01 Aug 2005 02:54:00 -0000 In-Reply-To: <200508010232.22389.gpiez@web.de> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-08/txt/msg00002.txt.bz2 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. 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