type_info::name question

Nathan Myers ncm@nospam.cantrip.org
Sat Sep 19 19:00:00 GMT 1998

Martin von Loewis wrote:
> > uses it won't be conforming.  With member name() there is at least
> > a chance, if the compiler implementors co-operate.
> This is what makes this approach particularly bad. Using the standard
> method will make it compile, yet it works in an implementation-defined
> way. Most users won't be aware of these details, and run into problems
> without being warned. 

I can't accept that.  The RTTI feature is a hook for support of object
databases and the like.  Anybody using it is painfully aware of the 
cross-platform issues.

> I'm not against g++ giving some additional guarantees about the string
> returned by name(); I just think it is bad advice to use name() as
> long as there no guarantees (unless it is used for debugging).
> For example, g++ could warn if name is called, while the user did not
> request specific semantics for it.

This would be a good thing.  In the absence of such a request the RTTI 
records could be smaller, which would also be a good thing.

Nathan Myers

More information about the Gcc mailing list