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]

 



Am Montag, 1. August 2005 06:12 schrieben Sie:
> 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.

I thought it over: "uniform" needs to be a template anyway, and knowing the 
name during compile time is sufficient. So some macro will do.

It was late and I was a bit tired yesterday, sorry for the noise :-)

Thanks for the answers.

[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