representing C++ constructors in GDB's symbol tables
David Carlton
david.carlton@sun.com
Sat Sep 18 00:18:00 GMT 2004
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
More information about the Gdb
mailing list