Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

An integer may be converted to any pointer type. Except as previously specified, the result is implementation-defined, might not be correctly aligned, might not point to an entity of the referenced type, and might be a trap representation.

This is These issues arise because the mapping functions for converting a pointer to an integer or an integer to a pointer are intended to must be consistent with the addressing structure of the execution environment.

...

In this non-compliant code example, the pointer ptr is used in an arithmetic operation that is eventually converted to an integer value. As previously stated, the result of this assignment and following assignment to ptr2 are implementation defined.

Code Block
bgColor#ffcccc

unsigned int myint = 0;
unsigned int *ptr = &myint;
/* ... */
unsigned int number = ptr + 1;
unsigned int *ptr2 = ptr;

...