Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!columbia!rutgers!husc6!cca!mirror!ima!minya!jc From: jc@minya.UUCP (John Chambers) Newsgroups: comp.lang.c,comp.unix.wizards Subject: Re: pointer alignment when int != char * Message-ID: <129@minya.UUCP> Date: Fri, 28-Aug-87 23:34:53 EDT Article-I.D.: minya.129 Posted: Fri Aug 28 23:34:53 1987 Date-Received: Sun, 30-Aug-87 07:27:08 EDT References: <493@its63b.ed.ac.uk> <6061@brl-smoke.ARPA> <3812@spool.WISC.EDU> <483@mtxinu.UUCP> Organization: home Lines: 30 Xref: mnetor comp.lang.c:4015 comp.unix.wizards:3965 In article <483@mtxinu.UUCP>, ed@mtxinu.UUCP (Ed Gould) writes: > ># To subtract two independent large-model pointers of the type > ># segment:offset, I tried this: > ># > ># (unsigned long) p2 - (unsigned long) p1 > ># > > > >This is bad practice. > > It's also not legal in the proposed ANSI C standard. Pointers > may be subtracted *only* if they point to members of the same > array of elements. Huh? This example isn't subtracting pointers to anything. It is subtracting two unsigned longs. I sure hope that's defined. I also hope that the ANSI standards haven't done THAT much damage to C semantics! (:-) -- John Chambers <{adelie,ima,maynard}!minya!{jc,root}> (617/484-6393)