If casting is required, make it explicit and use the following C++ cast operators:
const_cast: to remove the const, volatile, and __unaligned attributes.
dynamic_cast: for conversion of polymorphic types, where class hierachy navigation is unavoidable.
static_cast: for conversion of nonpolymorphic types.
This rule does not only apply to casting: it also applies to unsafe conversions by means of constructors, conversion operators, and conversion functions. See further [INT#001], [INT#017], [POR#022]. |