Google C++ style guide

Jeremie Pelletier jeremiep at gmail.com
Sun Oct 4 08:49:35 PDT 2009


Christopher Wright wrote:
> 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.

Yeah something like "don't generate type names" and other extra 
informations would be a definive plus, that makes reverse engineering 
too easy :)



More information about the Digitalmars-d mailing list