Saturday, May 23, 2009

The result of casting a pointer to an integer or vice versa.

When converting between integers and pointers of the same size, no
bits are changed. When converting from a longer type to a shorter, the
high-order bits are truncated. When converting from a shorter integer
type to a longer pointer type, the integer is first widened to an
integer type that is the same size as the pointer type. Thus signed
integers will sign-extend to fill the new bytes. Similarly, smaller
pointer types being converted to larger integer types will first be
widened to a pointer type that is as wide as the integer type.

No comments:

Post a Comment