Is is possible to use the name of a variable in the constructor?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux