Difference between revisions of "Cpp Coding Standards/TYPE"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
m (Cpp Coding Standards/Topics/TYPE moved to Cpp Coding Standards/Type Safety: Improve Cpp_Coding_Standards structure.)
(No difference)

Revision as of 14:48, 28 November 2006

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