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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bc1361a952ec75ca X-Google-Attributes: gid103376,public X-Google-Thread: 109fba,582dff0b3f065a52 X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,582dff0b3f065a52 X-Google-Attributes: gid1014db,public X-Google-ArrivalTime: 2001-08-07 21:38:02 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!rcn!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mail From: Lao Xiao Hai 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. Date: Tue, 07 Aug 2001 21:04:06 -0700 Organization: AdaWorks Software Engineering Message-ID: <3B70BA36.50A977BE@ix.netcom.com> References: <3b690498.1111845720@news.worldonline.nl> <9kbu15$9bj@augusta.math.psu.edu> <9kbvsr$a02@augusta.math.psu.edu> <3B69DB35.4412459E@home.com> <3B6F312F.DA4E178E@home.com> <23lok9.ioi.ln@10.0.0.2> <3B706FDC.E965C526@worldnet.att.net> Reply-To: richard@adaworks.com NNTP-Posting-Host: 9e.fc.c5.ae Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 8 Aug 2001 04:02:11 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:11573 comp.lang.c:72826 comp.lang.c++:80838 Date: 2001-08-08T04:02:11+00:00 List-Id: > Bart.Vanhauwaert@nowhere.be wrote: > > > > Warren W. Gay VE3WWG wrote: > > > And BTW, knowing the array bounds is not a problem. That is why Ada > > > provides convenient attributes like My_Array'First and My_Array'Last > > > (PL/I did it with builtin functions like lbound(My_Array) and hbound(My_Array) > > > IIRC). > > > > And as we all know, lazy programmers will not use 'First and 'Last, > > but will assume it's 0. > > Actually, when it comes to array processing, single- or multi-dimensional I find that Ada runs circles around the C family of languages. It is so easy to map the array indices to the problem being solved instead of being forced to index everything from zero. Also, when passsing a slice of an array to a function, I never need to test for the upper and lower bound of the array. Instead, 'First, 'Last, 'Range, and 'Length give me everything I need to create portable code. This is particulary useful when designing generic templates. My array index can be begin with a lower bound of a negative number, handy for certain problems. It can begin at any positive number, including a value greater than one, also often quite handy. Also, because Ada enumeration types are an actual set of ordered values, I can reliably index an array using the values of an enumeration type, without any concern for arithmetic interventions. Ada has true multi-dimensional arrays. Consequently, we can have a simple two or three- (or more) dimensional array as well as an array of an array (a la C). I can write algorithms that correspond directly to those found in Fortran (using a pragma Convention) so I may have an array that is either column major or row major, depending on the nature of the problem I need to solve. There are so many other examples that eclipse the capabilities of C that they are too numerous to address here. Suffice it to say, this is one area where C and C++ simply don't measure up to Ada. To be fair, a competent C++ programmer can use a smart array class instead of relying on raw language arrays. These correspond, loosely, to the array capabilities of Ada, but still fall somewhat short. In array processing, the designers of Ada got it right and the designers of the C family of languages never had a clue. Ada is by no means perfect in all respects, and some features of the C family of languages are quite nice, but Ada far surpasses C, C++, Java, and their close relatives when it comes to array management. Richard Riehle