From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,25b9eb5c3a89bced X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!news-east.rr.com!news-feed-01.rdc-kc.rr.com!news.rr.com!cyclone2.kc.rr.com!news2.kc.rr.com!tornado.socal.rr.com.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada Subject: Re: where exactly c++,c fail and Ada gets thru' References: <1145852356.559455.222600@i39g2000cwa.googlegroups.com> <1145855124.720029.35280@t31g2000cwb.googlegroups.com> From: Keith Thompson Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:vij7OicMoB9+OQqukLZfEYkNT1g= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 24 Apr 2006 22:34:17 GMT NNTP-Posting-Host: 66.75.136.120 X-Complaints-To: abuse@rr.com X-Trace: tornado.socal.rr.com 1145918057 66.75.136.120 (Mon, 24 Apr 2006 15:34:17 PDT) NNTP-Posting-Date: Mon, 24 Apr 2006 15:34:17 PDT Organization: Road Runner High Speed Online http://www.rr.com Xref: g2news2.google.com comp.lang.ada:3924 Date: 2006-04-24T22:34:17+00:00 List-Id: Simon Wright writes: > "jimmaureenrogers@worldnet.att.net" > writes: > >> The C standard explicitly >> allows one to access one element beyond the end of an array to >> support common practice in thousands of C programs. The C >> standard indicates that accessing more than one beyond the end >> of an array leads to undefined behavior. > > As I remember it, you are allowed to use the address of the element > one past the end of the array in a comparison with the addresses of > other elements of the same array, but not to access its content? Correct. Note that "allowed to" is a fairly weak statement in C; accessing elements beyond the bounds of an array isn't "allowed", but it's undefined behavior, meaning that the implementation is under no obligation to diagnose the error. -- Keith Thompson (The_Other_Keith) kst-u@mib.org San Diego Supercomputer Center <*> We must do something. This is something. Therefore, we must do this.