Am Montag, 1. August 2005 02:04 schrieb Ian Lance Taylor: > Gunther Piez <gpiez@xxxxxx> writes: > > struct uniform { > > uniform() { > > cout << "A variable called " << __PRETTY_VARNAME__ << " was just > > instantinated (sp)" << endl; > > } > > }; > > Remember that in general uniform::uniform may be in different source > file, and may be compiled before the function which uses a variable of > type uniform. The only way this could be made to work would be to > have the compiler secretly pass the variable name into the function. > There is no infrastructure for noting which functions would require > the variable name, or for passing in the variable name. Ok, I understand the difference to __PRETTY_FUNCTION__ now :-) Maybe it is possible to use the debugging information somehow? At least the debugger usually knows the names of variables. Otherwise I have to use a constructor like uniform::uniform(const char*); and declare variables like uniform blah("blah"); which is ugly.