Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Contiguous Arrays Message-ID: <1989Feb23.165715.9013@utzoo.uucp> Organization: U of Toronto Zoology References: <2508@ssc-vax.UUCP> <8943@alice.UUCP> <1828@valhalla.ee.rochester.edu> <1989Feb22.171441.7957@utzoo.uucp> <1831@valhalla.ee.rochester.edu> Date: Thu, 23 Feb 89 16:57:15 GMT In article <1831@valhalla.ee.rochester.edu> badri@valhalla.ee.rochester.edu (Badri Lokanathan) writes: >My argument is, since x is an independent variable (a pointer, but >still a variable,) there is no way of checking any array bounds. >Thus in order for consistency with the definition of pointer >arithmetic, >x -= i; x += i; >should result in the original value of x (provided the resulting >intermediate values are within pointer ranges.) Exactly -- provided the intermediate values do not cause an overflow. ON SOME MACHINES THEY CAN. It is not true that all machines have a single linear homogenous address space. Some have it broken up into pieces, and bad things can happen if your pointer arithmetic goes over the edge of a piece. >Further, the + and - operations group left to right and are >associative... In the absence of overflow. -- The Earth is our mother; | Henry Spencer at U of Toronto Zoology our nine months are up. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu