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.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,74a56083ffbe573d X-Google-Attributes: gid103376,public From: johnherro@aol.com (John Herro) Subject: Re: Zoo question Date: 1996/08/15 Message-ID: <4v0pme$c56@newsbf02.news.aol.com>#1/1 X-Deja-AN: 174475859 sender: root@newsbf02.news.aol.com references: <320F16B6.6944@lmtas.lmco.com> organization: America Online, Inc. (1-800-827-6364) newsgroups: comp.lang.ada Date: 1996-08-15T00:00:00+00:00 List-Id: Ken Garlington 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