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,5bc4be576204aa20 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Buffer overflow Article - CACM Date: 15 Nov 2005 20:21:12 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <43783810.6080808@obry.net> <2jzfmy3kqhw9$.10by8ooz0jy1b.dlg@40tude.net> <4379ea6d$0$21945$9b4e6d93@newsread2.arcor-online.net> <15gzlx0mv4n2t$.1ono4o1ozibur.dlg@40tude.net> <437a61d0$0$7421$9b4e6d93@newsread4.arcor-online.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1132104072 24261 192.74.137.71 (16 Nov 2005 01:21:12 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 16 Nov 2005 01:21:12 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:6413 Date: 2005-11-15T20:21:12-05:00 List-Id: Georg Bauhaus writes: > For sure you can get Constrain_Error using the library, > and this isn't alwas pleasant. Yet, in which ways is any of the > following more safe than the other? > > for I in X'Range loop > Modify_Element(X(I)); > end loop; > > Iterate(X, Modify_Element'Access); I'd say the second is less error-prone. You can't accidentally type X(J) or B(I) -- the extraneous and irrelevant "I" is not present in the second example, which is a good thing. It seems silly in a small example, but if the loop had a dozen or more lines of code, or were nested inside another loop, well.... - Bob