This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Next round of new demangler patches
- From: mec dot gnu at mindspring dot com (Michael Elizabeth Chastain)
- To: gdr at integrable-solutions dot net, ian at wasabisystems dot com
- Cc: dj at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Sun, 7 Dec 2003 00:47:32 -0500 (EST)
- Subject: Re: Next round of new demangler patches
(1) std::string::~string()
This is bad because it's not legal C++. Try compiling the appended
program with a typedef'd template. I'm really opposed to emitting
illegal C++ in a programmatic interface.
(2) std::string::~basic_string() is legal but it looks ugly.
Although actually it kinda grows on me the more I look at it. I
know it's a destructor because it has a ~. However the constructor,
std::string::basic_string(), does not even look like a constructor!
I think that std::string:basic_string() would astonish and confuse
people.
(3) std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string
This is legal and not as astonishing. That's my favorite, so I'm
glad that Ian picked it.
Michael C
===
template <class C> class tbase
{
private:
C c_;
public:
tbase ();
~tbase ();
};
template <class C> tbase<C>::tbase ()
{
c_ = 0;
}
template <class C> tbase<C>::~tbase ()
{
;
}
typedef tbase<char> t1_char;
typedef tbase<int> t2_int;
// This is legal.
t1_char::~tbase ()
{
;
}
// But this is not!
t2_int::~t2_int ()
{
;
}
int foo ()
{
t1_char my_t1_char;
t2_int my_t2_int;
return 0;
}