comp.lang.ada
 help / color / mirror / Atom feed
From: Bob Duff <bobduff@theworld.com>
Subject: Re: Strange error
Date: Fri, 23 Jan 2015 20:34:04 -0500
Date: 2015-01-23T20:34:04-05:00	[thread overview]
Message-ID: <87iofx9d2r.fsf@adacore.com> (raw)
In-Reply-To: m9ueav$of3$1@loke.gir.dk

"Randy Brukardt" <randy@rrsoftware.com> writes:

> "Laurent" <daemon2@internet.lu> 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.  ;-)

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.  Anyway, I think GNAT will give a warning
about that.

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.

- Bob

  reply	other threads:[~2015-01-24  1:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 21:46 Strange error Laurent
2015-01-23  7:45 ` Egil H H
2015-01-23  8:44   ` Laurent
2015-01-23 20:45     ` Laurent
2015-01-23 21:26     ` Randy Brukardt
2015-01-24  1:34       ` Bob Duff [this message]
2015-01-24 13:14         ` Brad Moore
2015-01-24 19:12           ` Laurent
2015-01-26 21:44         ` Randy Brukardt
2015-01-24  0:47     ` Bob Duff
2015-01-24 19:08       ` Laurent
2015-01-25  9:25     ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox