Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!columbia!rutgers!umnd-cs!umn-cs!randy From: randy@umn-cs.UUCP (Randy Orrison) Newsgroups: comp.lang.c,comp.unix.wizards Subject: Re: pointer alignment when int != char * Message-ID: <2130@umn-cs.UUCP> Date: Fri, 28-Aug-87 10:02:33 EDT Article-I.D.: umn-cs.2130 Posted: Fri Aug 28 10:02:33 1987 Date-Received: Sun, 30-Aug-87 05:56:42 EDT References: <493@its63b.ed.ac.uk> <6061@brl-smoke.ARPA> Reply-To: randy@umn-cs.UUCP (Randy Orrison) Organization: UofM Math Department Lines: 31 Xref: mnetor comp.lang.c:4006 comp.unix.wizards:3954 In article <483@mtxinu.UUCP> ed@mtxinu.UUCP (Ed Gould) writes: >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. How is this determined? example: int strlen(s) char *s; { register char *c; c = s; while(c++) ; return (c-s); } How does anything know if s & c are pointing to members of the same array? If s isn't 0 terminated, c could end up anywhere... (No flames on off-by-one errors, or any design issues. this is just an example) -randy -- Randy Orrison, University of Minnesota School of Mathematics UUCP: {ihnp4, seismo!rutgers!umnd-cs, sun}!umn-cs!randy ARPA: randy@ux.acss.umn.edu (Yes, these are three BITNET: randy@umnacvx different machines)