comp.lang.ada
 help / color / mirror / Atom feed
From: edward@igate1.hac.com (Ed Bruce)
Subject: Re: Optimizing and Constraint Checks
Date: 1995/03/29
Date: 1995-03-29T00:00:00+00:00	[thread overview]
Message-ID: <edward-2903951038050001@r-618macip27.hac.com> (raw)
In-Reply-To: 3l3l2v$ria@gnat.cs.nyu.edu

In article <3l3l2v$ria@gnat.cs.nyu.edu>, dewar@cs.nyu.edu (Robert Dewar) wrote:

> 
> Wait a moment! In the absence of an numeration rep clause, this whole
> discussion is irrelevant. If you don't have a rep clause, you just use
> Pos and Val to go backwards andd forwards and the whole apparatus of
> the generic is junk!

I realize now I should have provided more background and also debugged my
code before posting. I rushed this one out.

The underlining problem is how to represent enumeration types in an
external database(that is one not implemented directly in Ada). The
current solution is to use 'POS and 'VAL. The problem is our code is in a
very dynamic state and our enumerated types have and will continue to
change. Since 'POS and 'VAL for any given enumeration_literal for an
enumeration_type_definition may change as enumeration_literal's are added
or deleted from the enumeration_type_definition our database maintainer
has to modify the database to reflect these changes manually.

Which leads to an increased risk of making a mistake that won't be caught
easily if at all. That is if the an enumerated_value'POS is currently 5 in
the database and should be changed to 4 (a literal was deleted), but is
changed to 3. Well enumeration_type'VAL(3) is this case is legal but
invalid.

So I have suggested to the principal engineers on our project that we use
enumeration representation clauses and unchecked type conversion. This way
we are not dependant on the ordering of the enumeration_literal's. The
problem is ARM 13.10.2(3): "...it is the programmer's responsibility to
ensure that these conversions maintain the properties that are guaranteed
by the language for objects of the target type." My question was, is there
a portable way to do this and the answer I am getting is no for Ada, and
yes/maybe for Ada-95. 

Haing received these answers I have also proposed we look at using 'IMAGE
and 'VALUE instead and as expected I am receiving grumblings about sizing
and performance issues. Luckily all I have to do is propose solutions and
trade offs. The higher ups must balance cost, performance, and
maintainability and decide which solution is best.

-- 
Ed Bruce
edward@igate1.hac.com




  parent reply	other threads:[~1995-03-29  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-23 16:04 Optimizing and Constraint Checks Ed Bruce
1995-03-24 13:34 ` Theodore Dennison
1995-03-25 18:09   ` David Wheeler
1995-03-29  0:00   ` Ed Bruce
1995-03-24 20:15 ` Garlington KE
1995-03-26 12:01   ` Robert Dewar
1995-03-27 16:58     ` Garlington KE
1995-03-29  0:00     ` Ed Bruce [this message]
1995-03-29  0:00       ` Garlington KE
1995-03-30  0:00       ` Mike Meier
1995-04-04  0:00       ` Robert Dewar
1995-03-25 17:51 ` Robert Dewar
replies disabled

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