comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Strange error
Date: Mon, 26 Jan 2015 15:44:33 -0600
Date: 2015-01-26T15:44:33-06:00	[thread overview]
Message-ID: <ma6cg1$olp$1@loke.gir.dk> (raw)
In-Reply-To: 87iofx9d2r.fsf@adacore.com

"Bob Duff" <bobduff@theworld.com> wrote in message 
news:87iofx9d2r.fsf@adacore.com...
> "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.  ;-)

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.


  parent reply	other threads:[~2015-01-26 21:44 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
2015-01-24 13:14         ` Brad Moore
2015-01-24 19:12           ` Laurent
2015-01-26 21:44         ` Randy Brukardt [this message]
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