C/C++ Programmer's Guide (G06.27+, H06.08+, J06.03+)

a. Dereferencing a pointer-valued field of a structure when the structure pointer is null
b. Checking for a null pointer after some but not all pointer references, instead of before all
pointer references (see Example 10).
c. Dereferencing a pointer-valued member of a union when that alternative is not active and
initialized
2. Using syntactically correct but semantically incorrect and nonportable casts of these types:
To an integer pointer
To a structure pointer
From a char * pointer
From a void * pointer
From an integer expression
(For information about writing portable programs, see Writing Portable Programs
(page 45).)
These casts work only in TNS programs when the converted address is correctly aligned
for integer or structure objects (that is, when it is an even-byte address).
These are correctly aligned (that is, they have even-byte addresses):
Compiler-allocated objects
Heap objects
These might be misaligned (that is, they might have odd-byte addresses):
Declared items
char strings
Elements of char arrays
char fields of structures
Calculated items
char subscripts
Incremented char or void pointers
Casts of odd-valued integer expressions into a pointer types
See:
Example 11
Example 12
Example 16
3. Using a pointer union without direct assignment
Union of a pointer with other pointers or with integers is safe when the values of the unions
are mutually exclusive in time or when an equivalent explicit assignment of the address value
would be correct at run time. See Example 13: C/C++ Pointer Union (Item 3, Item 10).
4. Calling an undeclared or misdeclared external function
Actual parameter values are implicitly assigned to formal parameters. If formal parameters
are described incorrectly, these implicit assignments are equivalent to unchecked type casts.
386 Handling TNS Data Alignment