The mapping between pointers and integers must be consistent with the addressing structure of the
execution environment. Issues may arise, for example, on architectures that have a segmented memory model.
Constructing a pointer from an integer and accessing memory through that pointer are distinct operations.
A well-formed pointer may carry no provenance [FLS-WELL-FORMED-POINTER]
despite having a plausible machine address. Before the pointer is used to read or write memory, it must
have provenance permitting that access [FLS-POINTER-ACCESS-PROVENANCE] in
addition to satisfying the alignment, type, and representation conditions above.
This guideline constrains the result of the conversion. It does not claim that constructing or storing an
integer-derived pointer, without accessing memory through it, is by itself undefined behavior.
This guideline remains binding when code operates under an approved deviation from the guideline
A numeric value shall not be converted to a pointer: a deviation permits performing the
conversion, but does not permit the conversion to produce an invalid pointer.
|