comp.lang.ada
 help / color / mirror / Atom feed
From: "Samuel T. Harris" <u61783@gsde.hou.us.ray.com>
Subject: Re: Tables vs functions (was Re: Anonymous array clarification.)
Date: Mon, 20 Aug 2001 16:02:09 -0500
Date: 2001-08-20T16:02:09-05:00	[thread overview]
Message-ID: <3B817AD1.2DA2DF70@gsde.hou.us.ray.com> (raw)
In-Reply-To: 9lrhcn$9lc$1@nh.pace.co.uk

Marin David Condic wrote:
> 
> Or as an alternative:
> 
> > function Tomorrow(A_Day : in Day) return Day is
> > begin
> >   return Day'Succ(A_Day);
>   exception
>     when Constraint_Error =>
>         return Day'First ;
> > end Tomorrow;
> 
> There is, of course, going to be some debate about using exceptions for
> conditions you expect to happen. However, I'd point out that the code is a
> bit more brief and that in some implementations it might be (on the average)
> faster - for whatever that's worth. Its just an alternate implementation
> style. :-)
> 
> Which would I personally use? I'd usually go with what you described. There
> may be occasional uses of the Constraint_Error trap in things I write of
> this nature - I'm partial to that technique when implementing saturated
> arithmetic. Dunno if there is any consensus that it should be one way or
> another in this case - but its a good one to put in a programming style
> guideline. Like formatting rules, I'd go with whatever the style guide
> recommends for a given project.

Consider this ...

I'm using my debugger to trap an unhandled constraint_error
and I have to skip over this one several times before I
can get to the real one. For this reason alone I prefer
to do my own checking whenever possible.

-- 
Samuel T. Harris, Senior Software Engineer II
Raytheon, Aerospace Engineering Services
"If you can make it, We can fake it!"



  reply	other threads:[~2001-08-20 21:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-20  6:18 Anonymous array clarification McDoobie
2001-08-20  8:03 ` Phil Thornley
2001-08-20 16:49   ` Tables vs functions (was Re: Anonymous array clarification.) Ray Blaak
2001-08-20 17:28     ` Marin David Condic
2001-08-20 21:02       ` Samuel T. Harris [this message]
2001-08-21 14:13         ` Marin David Condic
2001-08-20  8:29 ` Anonymous array clarification David C. Hoos, Sr.
2001-08-20 10:26 ` Larry Hazel
2001-08-20 13:37 ` Samuel T. Harris
replies disabled

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