...
It is sometimes necessary in low-level kernel or graphics code to access memory at a specific location, requiring a literal integer to pointer conversion such as the following:
...
These conversions are machine dependent , and should only be coded when absolutely necessary.
...
In this non-compliant code example, the pointer ptr
is converted to an integer value. Both a pointer and an int
are assumed to be 32 bits. The high-order nine bits of the number are used to hold a flag value, and the result is converted back into a pointer.
...