From: johnherro@aol.com (John Herro)
Subject: Re: Zoo question
Date: 1996/08/15
Date: 1996-08-15T00:00:00+00:00 [thread overview]
Message-ID: <4v0pme$c56@newsbf02.news.aol.com> (raw)
In-Reply-To: 320F16B6.6944@lmtas.lmco.com
Ken Garlington <garlingtonke@lmtas.lmco.com> wrote:
> Get_Next_Animal: begin -- look carefully at this code!
> Next_Animal := Animal_ID'Succ(Next_Animal);
> exception
> when others => Next_Animal := Animal_ID'First;
> end Get_Next_Animal;
I realize that the point of this thread is to discuss the raising and
handling of Constraint_Error, but I think for the sake of any beginners
reading comp.lang.ada, we should point out the general rule not to use an
exception handler where a simple "if" will do. Thus, I think most people
will agree that the above could better be written
if Next_Animal = Animal_ID'Last then
Next_Animal := Animal_ID'First;
else
Next_Animal := Animal_ID'Succ(Next_Animal);
end if;
Again, I realize that's not the point of this thread, but I think
it's worth pointing out for the sake of beginners.
- John Herro
Software Innovations Technology
http://members.aol.com/AdaTutor
ftp://members.aol.com/AdaTutor
next prev parent reply other threads:[~1996-08-15 0:00 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-08-12 0:00 Zoo question Ken Garlington
1996-08-12 0:00 ` Chris Morgan
1996-08-13 0:00 ` Ken Garlington
1996-08-13 0:00 ` Ted Dennison
1996-08-14 0:00 ` Ken Garlington
1996-08-14 0:00 ` Ted Dennison
1996-08-15 0:00 ` Ken Garlington
1996-08-18 0:00 ` Robert Dewar
1996-08-19 0:00 ` Ted Dennison
1996-08-19 0:00 ` Mark A Biggar
1996-08-20 0:00 ` Robert Dewar
1996-08-15 0:00 ` Robert A Duff
1996-08-15 0:00 ` Robert Dewar
1996-08-15 0:00 ` Bob Gilbert
1996-08-19 0:00 ` Ted Dennison
1996-08-16 0:00 ` Ken Garlington
1996-08-19 0:00 ` Ted Dennison
1996-08-15 0:00 ` Keith Thompson
1996-08-14 0:00 ` Bob Gilbert
1996-08-14 0:00 ` Ted Dennison
1996-08-14 0:00 ` Bob Gilbert
1996-08-14 0:00 ` Ted Dennison
1996-08-14 0:00 ` Bob Gilbert
1996-08-14 0:00 ` Ken Garlington
1996-08-15 0:00 ` Robert A Duff
1996-08-16 0:00 ` Bob Gilbert
1996-08-19 0:00 ` Ted Dennison
1996-08-25 0:00 ` Robert Dewar
1996-08-15 0:00 ` Robert I. Eachus
1996-08-14 0:00 ` Paul Hussein
1996-08-15 0:00 ` John Herro [this message]
1996-08-16 0:00 ` Robert Dewar
1996-08-18 0:00 ` John Herro
1996-08-19 0:00 ` Ken Garlington
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox