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: 103376,31c0457c1c47fc2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-22 14:48:08 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!news.gtei.net!newsfeed1.cidera.com!Cidera!portc01.blue.aol.com!uunet!dca.uu.net!ash.uu.net!spool0900.news.uu.net!reader0901.news.uu.net!not-for-mail Sender: DB3L@CTWD0143 Newsgroups: comp.lang.ada Subject: Re: Have you ever had a bug caused by... References: <27085883.0110191714.784d3d25@posting.google.com> From: David Bolen Date: 22 Oct 2001 17:49:02 -0400 Message-ID: Organization: Fitlinxx, Inc. - Stamford, CT X-Newsreader: Gnus v5.7/Emacs 20.6 NNTP-Posting-Host: 208.247.212.3 X-Trace: 1003787290 reader1.ash.ops.us.uu.net 24890 208.247.212.3 Xref: archiver1.google.com comp.lang.ada:15049 Date: 2001-10-22T17:49:02-04:00 List-Id: mjsilva697@earthlink.net (Mike Silva) writes: > While discussing (er, pushing) Ada with some C-coding co-workers today > I asked a question to which I knew the answer (always the best kind!): > "Have you ever had a bug caused by accessing off the end of an > array?" Well, of course, they all had to say yes. Then I started > thinking of other bugs that they would have to admit to, and which > wouldn't occur in Ada. Nothing new here (Ada prevents many bugs...), > but I thought it would be fun and useful to develop a group list as an > Ada advocacy tool. For example: I'm curious as to how Ada _prevents_ such bugs. Are you saying that no Ada programmer has ever had a bug caused by walking off the end of an array either? I'll buy that Ada will catch that error more quickly than in C, and probably help isolate the problem more quickly. And even that by using attributes such as Range, Low and High that you can write more robust code to avoid the issue (which is no small benefit). But given that you can still compute indices and then attempt to dereference based on those computations, there has to be the occasional bug that is introduced through the use of indices that overflow the array. And that's different from saying "wouldn't occur in Ada" ... there's a difference between better handling of the bug, and not having the bug ever occur. Or to put it another way, if I have a bug that creates this condition (or say, tries to set a value outside its range, as in another example), generating an exception - even if handled - still implies the bug exists. Some of the suggested items appear to be language checks that are completely possible at compile time, for which I'd buy the "can't happen" argument. But any issues that can occur at runtime and require runtime checks and exceptions don't, IMHO, prevent bugs, but simply act to make it easier to diagnose and manage them when they do occur. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l@fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/