Google C++ style guide

Christopher Wright dhasenan at gmail.com
Sun Oct 4 03:18:01 PDT 2009


Jeremie Pelletier wrote:
> Me neither, in fact I would *love* to see a -nrtti switch in DMD to 
> disable the generation of all ClassInfo and TypeInfo instances, along 
> with a version identifier, maybe "version = RTTI_Disabled;" to let code 
> handle it.
> 
> I use RTTI a lot for simple debugging like printing the name of a class 
> or type in generic code or meta programming, but not at all in 
> production code. Most of the time I can rely on .stringof and a message 
> pragma to do the same.

You use RTTI for dynamic casts, variadic functions, and the default 
implementation of toString. You could safely eliminate some fields from 
ClassInfo and TypeInfo, but you can't get rid of them entirely.

The best you can do is make TypeInfo entirely opaque (no fields) and 
only include the base class, interfaces, and name for ClassInfo.



More information about the Digitalmars-d mailing list