public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Gunther Piez <gpiez@web.de>
To: gcc-help@gcc.gnu.org
Subject: Is is possible to use the name of a variable in the constructor?
Date: Sun, 31 Jul 2005 23:56:00 -0000	[thread overview]
Message-ID: <200508010155.53152.gpiez@web.de> (raw)

I'm looking for something like __PRETTY_FUNCTION__ for a variable (or a 
object).
It want to do

struct uniform {
	uniform() {
		cout << "A variable called " << __PRETTY_VARNAME__ << " was just 
instantinated (sp)" << endl;
	}
};

void main() {
	uniform blah;
}


and get "A variable called blah was just instantinated" as program output. 
This must work at runtime. Is there a identifier or macro which holds the 
desired value?

             reply	other threads:[~2005-07-31 23:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-31 23:56 Gunther Piez [this message]
2005-08-01  0:04 ` Ian Lance Taylor
2005-08-01  0:32   ` Gunther Piez
2005-08-01  2:54     ` Ian Lance Taylor
2005-08-01  4:13       ` Daniel Berlin
2005-08-01 20:04         ` Gunther Piez
2005-08-01 11:29 ` Eljay Love-Jensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200508010155.53152.gpiez@web.de \
    --to=gpiez@web.de \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).