Re: 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]

 



On Sun, 2005-07-31 at 19:53 -0700, Ian Lance Taylor wrote:
> Gunther Piez <gpiez@xxxxxx> writes:
> 
> > 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;
> > > > 	}
> > > > };
> 
> ...
> 
> > 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.

> Remember that the debugger doesn't know the name within
> uniform::uniform.  It only knows the name if you go up the stack frame
> to the caller.
> 
> Ian


[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