An inheriting class with a user-defined copy constructor must call its base class's copy constructor.
Fall-through in switch cases is often considered risky.
Hence consider adding an unconditional
break for each switch clause.
sizeof()in memory allocation CXX-S1006
malloc function usually expects a memory size value in units (usually
when allocating any type. Use
sizeof(type) * number_of_values as the size argument
malloc to avoid making mistakes.
doublein a math function CXX-P2001
Calling math functions that only accept
causes an implicit type promotion of
double costs extra space in memory, it also costs extra
instructions for the conversion from
float and lastly vectorisation of
is a lot more efficient compared to
Pointer offset(or any other arithmetic operation) on a pointer casted to a different type (than its original type) is risky and can result in undefined behaviour. The reason for such behaviour is that the memory alignment may change for types on every targeted platform.