11.8 Arrays and Pointers
ISO Standard | Implementation |
---|---|
“The result of converting a pointer to an integer or vice versa (C90 6.3.4, C99 6.3.2.3).” | |
When converting an integer to a pointer variable, if the pointer
variable throughout the entire program is only assigned the addresses of
objects in data memory or is only assigned the addresses of objects in program
memory, the integer address is copied without modification into the pointer
variable. If a pointer variable throughout the entire program is assigned
addresses of objects in data memory and also addresses of objects in program
memory, then the MSb of the integer value will be set if it is explicitly cast
to a pointer to const type; otherwise the MSb is not set. The remaining bits of
the integer are assigned to the pointer variable without modification. When converting a pointer to an integer, the value held by the pointer is assigned to the integer without modification. The usual integer truncation applies if the integer is larger than the size of the pointer. |
|
“The size of the result of subtracting two pointers to elements of the same array (C90 6.3.6, C99 6.5.6).” | |
The signed integer result will have the same size as the pointer operands in the subtraction. |