public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Is is possible to use the name of a variable in the constructor?
@ 2005-07-31 23:56 Gunther Piez
  2005-08-01  0:04 ` Ian Lance Taylor
  2005-08-01 11:29 ` Eljay Love-Jensen
  0 siblings, 2 replies; 7+ messages in thread
From: Gunther Piez @ 2005-07-31 23:56 UTC (permalink / raw)
  To: gcc-help

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?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-08-01 20:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-31 23:56 Is is possible to use the name of a variable in the constructor? Gunther Piez
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

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).