comp.lang.ada
 help / color / mirror / Atom feed
From: Ed Falis <efalis@mediaone.net>
Subject: Re: Whether to raise exception or End_of_List function
Date: Wed, 21 Nov 2001 19:34:07 GMT
Date: 2001-11-21T19:34:07+00:00	[thread overview]
Message-ID: <3BFC027C.8E30FD37@mediaone.net> (raw)
In-Reply-To: vm2SekYPoYju@eisner.encompasserve.org

Larry Kilgallen wrote:
> 
> In article <slrn9vnh96.55u.randhol+abuse@kiuk0156.chembio.ntnu.no>, Preben Randhol <randhol+abuse@pvv.org> 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



  parent reply	other threads:[~2001-11-21 19:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-21 15:17 Whether to raise exception or End_of_List function Preben Randhol
2001-11-21 16:32 ` Preben Randhol
2001-11-21 16:51 ` Mark Biggar
2001-11-21 17:00   ` Preben Randhol
2001-11-21 17:01 ` Larry Kilgallen
2001-11-21 17:03   ` Preben Randhol
2001-11-21 19:34   ` Ed Falis [this message]
2001-11-21 17:04 ` chris.danx
2001-11-21 17:09   ` chris.danx
2001-11-21 22:00   ` Larry Kilgallen
2001-11-21 17:11 ` Jeffrey Carter
2001-11-21 17:53 ` Stephen Leake
2001-11-21 18:51   ` Preben Randhol
2001-11-22  3:53     ` Nick Roberts
2001-11-22 10:23       ` Preben Randhol
2001-11-23 14:37       ` Preben Randhol
replies disabled

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