This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: representing C++ constructors in GDB's symbol tables
- From: David Carlton <david dot carlton at sun dot com>
- To: Jim Blandy <jimb at redhat dot com>
- Cc: gdb at sources dot redhat dot com
- Date: Fri, 17 Sep 2004 17:17:45 -0700
- Subject: Re: representing C++ constructors in GDB's symbol tables
- References: <vt2pt4ko6p7.fsf@zenia.home>
On Fri, 17 Sep 2004 17:45:40 -0500, Jim Blandy <jimb@redhat.com> said:
> It occured to me that perhaps constructors should not be in the
> VAR_DOMAIN.
This sounds plausible, though I'm not entirely convinced, but for what
it's worth this next claim of yours isn't really true:
> You can't use them by name in expressions: you have to say "new
> X(...)", never "X(...)".
You can use "X(...)" to create a temporary object of type X. E.g. the
following program works fine.
#include <iostream>
class Printer {
public:
void print() const {
std::cout << "print!\n";
}
};
int main() {
Printer().print();
return 0;
}
Having said that, a constructor really is a different beast from an
ordinary function call. And I don't think that having GDB support
(gdb) print Printer().print()
should be high on your list of priorities.
David Carlton
david.carlton@sun.com