Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!husc6!necntc!cullvax!drw From: drw@cullvax.UUCP Newsgroups: comp.lang.c Subject: Pointer Comparison and Portability Message-ID: <814@cullvax.UUCP> Date: Thu, 19-Feb-87 11:07:56 EST Article-I.D.: cullvax.814 Posted: Thu Feb 19 11:07:56 1987 Date-Received: Fri, 20-Feb-87 21:38:59 EST Organization: Cullinet Software, Inc., Westwood, MA Lines: 23 john@viper.UUCP (John Stanley) writes: > Tom, on segmented arcitecture machines you -could- have two distinctly > different pointer values which point to the same memory space. This is > what Israel Pinkas was (I think) trying to point out. > > In the example he gave: > char p[16], q[16]; > (Details of 8086 memory addressing omitted.) > The byte of memory addressed by q[0] and p[17] would > be the exact same byte, but the two pointers 0002:0000 and 0001:0010 would be > different. Yes, but comparing &p[17] and &q[0] is comparing two addresses derived from different allocations, and as the standard says, that is implementation defined (i.e., may not work). Note also that &p[17] is a correct *pointer*, but attempting to fetch or store anything through it is not. &p[18] is not a correct pointer. Dale -- Dale Worley Cullinet Software UUCP: ...!seismo!harvard!mit-eddie!cullvax!drw ARPA: cullvax!drw@eddie.mit.edu