g++ 2.95 typeinfo::name()

Kellogg, Oliver Oliver.Kellogg@vs.dasa.de
Tue Jan 23 00:04:00 GMT 2001


dewar at gnat dot com wrote:

>   Some would argue that "useful
> " implementations of impl-defined stuff are inherently undesirable
> since they encourage non-portable programming, so who is to judge
> what is useful and not useful, [...]

Here is what I was trying to do.

template <class Interface>
class T {
  private:
    string _name;
  public:
    T () : _name (typeid (Interface).name ()) {}
    virtual ~T () {}
    const char *name () const { return _name.c_str (); }
    void export_to_corba_naming_service ();
};

The export method exports the _name to a CORBA naming service.
Importers have knowledge of the class name, but do not have 
knowledge of the convention used by the particular RTTI 
system for determining this name. I guess what I'm saying is 
I may not do stuff like this. Thus, the typeinfo::name() is 
useless in this particular case.

Thanks.

Oliver M. Kellogg


More information about the Gcc mailing list