Dereferencing Typecast Integer Literals

David Tanguay datangua at watmath.waterloo.edu
Tue Feb 5 10:41:42 AEST 1991


In article <15067 at smoke.brl.mil> gwyn at smoke.brl.mil (Doug Gwyn) writes:
>Also, each implementation is required to
>provide SOME integral type to which any data pointer can be cast such
>that upon subsequent cast back to the same type of pointer, the new
>pointer value will compare equal to the old value.

Where does the standard say this?  3.3.4 says a pointer may be converted
to some integral type, and that an integer may be converted to a pointer,
but the result is implementation defined. Whether or not the pointer
value is preserved across pointer -> int -> pointer is implementation
defined. For example, the pointer -> integer conversion could drop the
segment of the pointer, and the integer -> pointer could apply some
default segment (the integer gets the offset).
-- 
David Tanguay            Software Development Group, University of Waterloo



More information about the Comp.std.c mailing list