Synopsis: | Do not cast a pointer to a shorter quantity to a pointer to a longer quantity |
Language: | C++ |
Severity Level: | 1 |
Category: | Portability |
Description: |
A processor architecture often forbids data of a given size to be allocated at an arbitrary address. For example, a word must begin on an "even" address for MC680x0. If there is a pointer to a char which is located at an "odd" address, a type conversion from this char pointer to an int pointer will cause the program to crash when the int pointer is used, since this violates the processor's rules for alignment of data. See also [CON#001]. |