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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Strange error Date: Mon, 26 Jan 2015 15:44:33 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <713608f7-d46e-4b73-a34e-552d1b978d2c@googlegroups.com><01fc779f-e274-4515-a88f-144d515d323f@googlegroups.com><3fa7d4c4-f9fe-4d00-9034-a348802087a9@googlegroups.com> <87iofx9d2r.fsf@adacore.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1422308673 25273 24.196.82.226 (26 Jan 2015 21:44:33 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 26 Jan 2015 21:44:33 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:24746 Date: 2015-01-26T15:44:33-06:00 List-Id: "Bob Duff" wrote in message news:87iofx9d2r.fsf@adacore.com... > "Randy Brukardt" writes: > >> "Laurent" wrote in message >> news:3fa7d4c4-f9fe-4d00-9034-a348802087a9@googlegroups.com... >> ... >>> How do you professionals prevent such stupid errors? I am just a noob >>> and >>> playing >>> a bit around so it has no impact on anything. >> >> You don't (or at least, I don't). I seem to write loops that don't loop >> (forgot the P := P.Next) all the time. > > "don't loop"? That loops too much. ;-) Meant "don't stop looping", obviously. > I tend to write the boilerplate first: > > while P /= null loop > > P := P.Next; > end loop; > > Then go back and fill in the body of the loop. So I don't usually > make that particural mistake. I don't make "particural" mistakes, either. ;-) I sometimes do that, but sometimes I'm so focused on the important stuff (the body of the loop) that I forget the structure. > Anyway, I think GNAT will give a warning > about that. It certainly goves warnings on loops that aren't a problem. :-) I've never seen one on a loop that is a problem, but then again, most of my code was written using another compiler first, so most of the gross errors have already been removed. > But in Ada 2012, we have iterators, which largely solves the problem. > Put all your eggs in one basket, and if the iterator works, then all > the myriad "for" loops around the code will work. Yeah, but that would mean finding time to implement them in my favorite compiler. :-) Randy.