TITLE: referencing beyond the end of an array (Newsgroups: comp.lang.c++, 15 Jan 97) DEWAR: dewar@merv.cs.nyu.edu (Robert Dewar) >>equally if you do something like >> >> (x = p; x < &p[10]; p += 3) >> >>you can find you have an infinite loop, all quite in accordance with the >>C semantics, although somewhat surprising. KENNER: kenner@lab.ultra.nyu.edu (Richard Kenner) >This case must work. Such a reference to the end of an object is required >to be treated like a reference within the object. HENDERSON: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson) No, you missed the subtle point of Robert Dewar's example. (Robert could obviously get a job advertising PC-LINT if he wanted ;-) If it was `p++' rather than `p += 3', you would be right, but since it is `p += 3', the behaviour is undefined -- ANSI/ISO C only allows a reference to one past the end of an object, not two past the end.