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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,582dff0b3f065a52 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,bc1361a952ec75ca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-09 08:48:03 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.uchicago.edu!newsfeed.cs.wisc.edu!loops.cs.wisc.edu!newshub.sdsu.edu!newspeer.cts.com!easynews!e420r-sjo4.usenetserver.com!usenetserver.com!e3500-atl2.usenetserver.com.POSTED!clarkcox3 Newsgroups: comp.lang.ada,comp.lang.c++ Subject: Re: How Ada could have prevented the Red Code distributed denial of service attack. From: clarkcox3@yahoo.com (Clark S. Cox III) Message-ID: <1exve0j.1lboe8gneysd0N%clarkcox3@yahoo.com> References: <3B6555ED.9B0B0420@sneakemail.com> <87n15lxzzv.fsf@deneb.enyo.de> <3B672322.B5EA1B66@home.com> <5ee5b646.0108010949.5abab7fe@posting.google.com> <%CX97.14134$ar1.47393@www.newsranger.com> <9ka1jc$mgd@augusta.math.psu.edu> <3b690498.1111845720@news.worldonline.nl> <9kbu15$9bj@augusta.math.psu.edu> <9kbvsr$a02@augusta.math.psu.edu> <3B69DB35.4412459E@home.com> <9kp9n7$ivm$1@nh.pace.co.uk> User-Agent: MacSOUP/2.4.6 X-Complaints-To: abuse@usenetserver.com X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly. NNTP-Posting-Date: Thu, 09 Aug 2001 11:47:12 EDT Organization: Bellsouth.Net Date: Thu, 9 Aug 2001 11:48:00 -0400 Xref: archiver1.google.com comp.lang.ada:11687 comp.lang.c++:81237 Date: 2001-08-09T11:48:00-04:00 List-Id: [distribution fixed] Ted Dennison wrote: > In article , Bart.Vanhauwaert@nowhere.be says... > > > >Marin David Condic wrote: > >> And don't forget 'Range - very useful for "for" loops. And the same thing > > >I am not really sure where this is fundamentally different from > > > >for (std::vector::iterator i=v.begin(); i!=v.end(); ++i) > > That's actually pretty close, and seems to have all the benifits Marin was > touting. Its a shame I've never seen it "in the wild". :-) Umm... Are you saying that you've never seen anything about the STL? If so, then you are hardly in a position to critique C++. > There are some differences, though: > > o In the Ada version, "i" would not be assignable within the loop. What happens when you want to skip over an element of the vector? delete an item from the vector? > This allows the compiler to optimize things a lot more easily. > o I'm not to sure how C++ compilers implement calls to the iterator's "++" > operator, but it looks like a function call to me (perhaps even a dispatching > one?). It can be, but it can also be an inline function, or a simple call-through to the built in operator++, in both cases, any compiler worth it's salt would only use a single machine instruction (unless, of course such an instruction doesn't exist on a platform, in which case Ada couldn't do it either). >The Ada for loop is going to use whatever hardware incrementation >method is fastest (assuming it doesn't just unroll some or all of the >loop). In a tight loop, the speed difference could be significant. This is no different from what a decent C++ compiler would do. -- Clark S. Cox III clarkcox3@yahoo.com http://www.whereismyhead.com/clark/