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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,582dff0b3f065a52 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,bc1361a952ec75ca X-Google-Attributes: gid103376,public X-Google-Thread: 109fba,582dff0b3f065a52 X-Google-Attributes: gid109fba,public X-Google-ArrivalTime: 2001-08-09 18:06:00 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!news.gtei.net!enews.sgi.com!newshub2.rdc1.sfba.home.com!news.home.com!news1.rdc2.on.home.com.POSTED!not-for-mail Message-ID: <3B73337F.862F8D93@home.com> From: "Warren W. Gay VE3WWG" X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++ Subject: Re: How Ada could have prevented the Red Code distributed denial of service attack. References: <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> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 10 Aug 2001 01:05:59 GMT NNTP-Posting-Host: 24.141.193.224 X-Complaints-To: abuse@home.net X-Trace: news1.rdc2.on.home.com 997405559 24.141.193.224 (Thu, 09 Aug 2001 18:05:59 PDT) NNTP-Posting-Date: Thu, 09 Aug 2001 18:05:59 PDT Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: archiver1.google.com comp.lang.ada:11731 comp.lang.c:73298 comp.lang.c++:81420 Date: 2001-08-10T01:05:59+00:00 List-Id: Bart.Vanhauwaert@nowhere.be wrote: > Ted Dennison wrote: > >>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". :-) > > I use it all the time (and love it) Don't forget that in Ada, there are Booch components that sports iterator types that can be used in a manner that is similar. But I think the thing that has been lost in all of this is that you are comparing C++ _STL_ features with Ada _language_ features. But C++ users always want to appeal to the STL to solve the C++ language deficiencies. If you compared _language_ for _language_, you'd have a lot of minuses in the C++ camp. Language for language, Ada95 is unmistakably "better" in almost all ways that I can think of (there are a few minor exceptions of course). However, if we then compared C++ _STL_ with _Booch components_, you'd have some pluses, and Ada would have some pluses, but some minuses. I suppose the biggest _minus_ on the Ada side is that _Booch components_ are not part of any _standard_ or official Ada offering AFAIK. (I will also plead ignorance of the Ada83 booch components library). I suppose you could imagine the next 5 years running something like this: C++ camp improves upon compilers and/or language to improve quality at compile time, insert optional runtime checks. Ada95 camp improves upon and maybe standardizes upon an official version of the Booch components. > > 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?). 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 depends on the implementation of the STL of course. It certainly is > not a virtual function call. std::vector::iterator is a either a > wrapper around an int or a pointer to What. In both cases it translates > to just pre-incrementing the pointer or the integer. Modern compilers > have no trouble optimizing this. It is true that unless they did something wacky like make it virtual, the C++ inline ++ operator is usually cheap. The biggest difficiency here though is that C++ programmers must use STL containers to buy any sort of safety. It is simply unnecessary to resort to a Vector container in Ada for safety. Naked arrays in Ada have all the protection and convenience one could ask for. It is also easier to read the code that uses it, and hence makes code audits much easier. -- Warren W. Gay VE3WWG http://members.home.net/ve3wwg