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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 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 10:55:04 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!psinet-eu-nl!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" 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, 7 Aug 2001 13:49:24 -0400 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <9kp9n7$ivm$1@nh.pace.co.uk> References: <3b690498.1111845720@news.worldonline.nl> <9kbu15$9bj@augusta.math.psu.edu> <9kbvsr$a02@augusta.math.psu.edu> <3B69DB35.4412459E@home.com> NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 997206567 19446 136.170.200.133 (7 Aug 2001 17:49:27 GMT) X-Complaints-To: newsmaster@news.cam.pace.co.uk NNTP-Posting-Date: 7 Aug 2001 17:49:27 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:11513 comp.lang.c:72722 comp.lang.c++:80705 Date: 2001-08-07T17:49:27+00:00 List-Id: And don't forget 'Range - very useful for "for" loops. And the same thing works with multiple dimensions as in Some_Array'First (1) or Some_Array'Range (2) or Some_Array'Length (N). What is really useful here is that if you avoid coding things with hard references into the array, you can pretty much leave the code untouched if/when you make any changes to the sizes/indexes of the array. It gets even more useful when trying to write generic array utilities or utilities that can deal with a *slice* of an array. (Like: "Some_Procedure (Some_Array (6..23)) ;" - if the internals use the attributes, it works nicely for any slice.) In general the attributes are *very* handy because they provide information that the compiler just automatically knows about and can use so that things are not hard coded. To some extent you can do this in C/C++ by defining your own constants or functions but ultimately a change to the data structure means revisiting this code - possibly missing something. With Ada, a change to the data structure should just take care of itself as long as you use the attributes. (Of course, there isn't anything to stop you from hard-coding things in Ada as well - but if you hose it up, at least you'll get a compiletime or runtime error letting you know you did that.) MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "Ted Dennison" wrote in message news:JzUb7.1653$NJ6.5860@www.newsranger.com... > > That's why we use 'First and 'Last in Ada. So we have both the advantage you > quote, and the one you discount. :-) >