Newsgroups: comp.std.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Out-of-bounds pointers Message-ID: <1989Oct6.165246.5953@utzoo.uucp> Organization: U of Toronto Zoology References: <1009@mtxinu.UUCP> <12570028@hpclwjm.HP.COM> Date: Fri, 6 Oct 89 16:52:46 GMT In article <12570028@hpclwjm.HP.COM> walter@hpclwjm.HP.COM (Walter Murray) writes: >the wording of 3.3.6 might be misleading: "Unless both the pointer >operand and the result point to elements of the same array object, >or the pointer operand points one past the last element of an array >object and the result points to an element of the same array object, >the behavior is undefined if the result is used as an operand of >the unary * operator." Doesn't this imply rather strongly that it >IS legal to compute an invalid address, as long as it isn't >dereferenced? Read the previous sentence in 3.3.6: "If both the pointer operand and the result point to elements of the same array object, or one past the last element of the array object, the evaluation shall not produce an overflow; otherwise the behavior is undefined." -- Nature is blind; Man is merely | Henry Spencer at U of Toronto Zoology shortsighted (and improving). | uunet!attcan!utzoo!henry henry@zoo.toronto.edu