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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fd8f3d2ebf73a4b7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-21 11:36:44 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!feed2.news.rcn.net!rcn!chnws02.mediaone.net!chnws06.ne.mediaone.net!65.96.0.182!typhoon.ne.mediaone.net.POSTED!not-for-mail Message-ID: <3BFC027C.8E30FD37@mediaone.net> From: Ed Falis X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.3 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Whether to raise exception or End_of_List function References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Wed, 21 Nov 2001 19:34:07 GMT NNTP-Posting-Host: 24.60.18.249 X-Complaints-To: abuse@mediaone.net X-Trace: typhoon.ne.mediaone.net 1006371247 24.60.18.249 (Wed, 21 Nov 2001 14:34:07 EST) NNTP-Posting-Date: Wed, 21 Nov 2001 14:34:07 EST Organization: ATT Broadband Xref: archiver1.google.com comp.lang.ada:16814 Date: 2001-11-21T19:34:07+00:00 List-Id: Larry Kilgallen wrote: > > In article , Preben Randhol writes: > > > My question is which is the better solution; Exception or a End_of_List > > function and which would have fewer side effects? > > Exceptions are supposed to be rare events. In many applications > reaching the end of a list is fully expected and not necessarily > rare. > > Exception processing can take significant overhead, since compiler > implementors know it will be rare. Personally, I'm inclined to follow the Eiffel DbC style by stating the conditions for calling any routine, and those that are guaranteed on return, rather than using exception processing as part of the normal execution of the routine. By using pragma Assert (available at least on GNAT and the Averstar-based compilers), you can enable the assertions during development, then turn them off for production. - Ed