From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12911 invoked by alias); 1 Aug 2005 20:04:11 -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 12782 invoked by uid 22791); 1 Aug 2005 20:04:08 -0000 Received: from smtp07.web.de (HELO smtp07.web.de) (217.72.192.225) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 01 Aug 2005 20:04:08 +0000 Received: from [85.212.41.114] (helo=[192.168.1.18]) by smtp07.web.de with esmtp (TLSv1:RC4-MD5:128) (WEB.DE 4.105 #314) id 1DzgW6-0007Ps-00 for gcc-help@gcc.gnu.org; Mon, 01 Aug 2005 22:04:06 +0200 From: Gunther Piez To: gcc-help@gcc.gnu.org Subject: Re: Is is possible to use the name of a variable in the constructor? Date: Mon, 01 Aug 2005 20:04:00 -0000 User-Agent: KMail/1.8.2 References: <200508010155.53152.gpiez@web.de> <1122869578.32467.102.camel@linux.site> In-Reply-To: <1122869578.32467.102.camel@linux.site> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200508012204.05291.gpiez@web.de> X-Sender: gpiez@web.de X-SW-Source: 2005-08/txt/msg00018.txt.bz2 Am Montag, 1. August 2005 06:12 schrieben Sie: > 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. I thought it over: "uniform" needs to be a template anyway, and knowing the name during compile time is sufficient. So some macro will do. It was late and I was a bit tired yesterday, sorry for the noise :-) Thanks for the answers.