Cpp Coding Standards/TYPE

From Apache OpenOffice Wiki
< Cpp Coding Standards
Revision as of 18:20, 27 November 2006 by Np (Talk | contribs)

Jump to: navigation, search

Type Safety

Casts and type recognition


Summary

TypesNotRepresentations

Rely on types, not on representations. Don't think in bits, don't memcpy non-PODs.

NoCStyleCasts

Don't use C-Style casts, but the C++ casts.

AvoidPtrStaticCasts

Use dynamic_cast instead of static_cast when treating pointers polymorphically.

NoTypeSwitching

Don't use switch, when the cases represent types. Prefer polymorphism.


Related Rules


Explanations


Personal tools