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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,81cf52699486abe7 X-Google-Attributes: gid103376,public From: "Steve Doiel" Subject: Re: Ada95 Strengths/Weaknesses. Date: 1999/09/28 Message-ID: <37f182d5.0@news.pacifier.com>#1/1 X-Deja-AN: 530556966 References: <37EED7B8.245C0054@yukyonline.co.yuky> <37EF9B98.7F817CC0@pwfl.com> <7sqb4r$15d$1@nnrp1.deja.com> <7sqmk6$1ck3@drn.newsguy.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Trace: 28 Sep 1999 20:09:09 PST, 216.65.140.224 X-MSMail-Priority: Normal Reply-To: "Steve Doiel" Newsgroups: comp.lang.ada Date: 1999-09-28T00:00:00+00:00 List-Id: wrote in message news:7sqmk6$1ck3@drn.newsguy.com... > In article , Preben says... > > >True. Most bugs are discovered _reading_ through the source code > >rather than just testing the software. > > programmers reading the code?? This is a new one. > > seriously, one of the biggest problems I see is that many > programmers do NOT read the code. They try something, it failes, jump > into the debugger, set up a test, buy new hardware, hire more testers, > run a profiler, etc.. they do all that, except actualy EXAMINE the code ! Actually I frequently print out and exammine source code. Although I can see your point. When I learned FORTRAN we used keypunch machines and punch cards. After putting together our deck we submitted our programs for a batch run. This run might not be complete as long as 3 hours. Sometimes I still amaze myself at my ability to distinguish a zero from an "O" when reviewing code. Along the same lines this is one of the reasons I prefer Ada. Just today one of my co-workers was struggling with a bug in a C program and asked for my assistance. His program was transferring data from one array to another: unsigned int idx; for( idx = beg; idx <= end; idx++ ) { dest[ j++ ] := src[ idx ]; } He needed to change the loop to store the data in the opposite order, so he changed the code to read: unsigned int idx; for( idx =end; idx >= beg; idx-- ) { dest[ j++ ] := src[ idx ]; } And then spent a few hours trying to figure out why the program "locked up". In case you missed it, when beg = 0, "idx >= beg" is always true for an unsigned integer (idx) so he had an infinite loop. Programmers are mortal. Had this program been written in Ada he could have spent these hours doing something productive. for idx in reverse beg .. endIdx loop dest( j ) := src( idx ); j := j + 1; end loop; BTW: There are loads of other tricky examples like this one. This is just one example of what I consider to be a strength of Ada when compared with C. SteveD