type_info::name question

Martin von Loewis martin@mira.isdn.cs.tu-berlin.de
Thu Sep 17 18:37:00 GMT 1998


> Sorry, I don't agree.  The industrial use of type_info::name is to 
> generate a key to represent a type for streamed object representations.

Unfortunately, this is a non-portable use. The standard does not
guarantee any properties of the string returned, not even uniqueness
in some sense.

> I imagine a future need for a compiler flag that chooses the RTTI
> name convention, choosing between mangling, squangling, and some
> POSIX- or CORBA-specified convention.

I'd rather make this an explicit GNU extension, giving it a different
method name as well. Using CORBA conventions might not even be a bad
idea,

namespace X{
  class Y{
  };
};

char *s = typeid(X::Y).__repository_id();

might initialize s to "gnu:X/Y:1.0" or some such. Telling people they
can use type_info::name for this application is bad advice.

Regards,
Martin



More information about the Gcc mailing list