Cpp Coding Standards/TYPE

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

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Type Safety

Casts and type recognition


Rules

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


Personal tools