Xref: utzoo comp.lang.c:35785 comp.std.c:4237 Newsgroups: comp.lang.c,comp.std.c Path: utzoo!utgpu!watserv1!watmath!datangua From: datangua@watmath.waterloo.edu (David Tanguay) Subject: Re: Dereferencing Typecast Integer Literals Organization: University of Waterloo Date: Mon, 4 Feb 91 23:41:42 GMT Message-ID: <1991Feb4.234142.26867@watmath.waterloo.edu> Followup-To: comp.std.c References: <15067@smoke.brl.mil> Lines: 15 In article <15067@smoke.brl.mil> gwyn@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