comp.lang.ada
 help / color / mirror / Atom feed
From: dog.ee.lbl.gov!agate!spool.mu.edu!umn.edu!email.sp.paramax.com!not-for-ma il@ucbvax.Berkeley.EDU  (Robert Parkhill)
Subject: Re: Unchecked_Conversion question
Date: 3 Sep 93 19:06:47 GMT	[thread overview]
Message-ID: <2684k7$2hc@sun_tzu.sp.paramax.com> (raw)

adam@irvine.com (Adam Beneschan) writes:
> In article <1993Sep1.154715.10498@Rapnet.Sanders.Lockheed.Com> lvonrude@Rapne
t.Sanders.Lockheed.Com (Lowell S. VonRuden x5294) writes:
> 
> Anyway, if you want a more dependable version, try this:
> 
  -- Deleted text
> 
>     if Int not in Enum_Low .. Enum_High then
>       raise Constraint_Error;   -- or whatever
>     end if;
>     E := Convert (Int);  
> 
>   end Sample;


I would not count on this being dependable, please refer to Tucker
Taft's post.  I can tell you that people I have worked with tried
this with the TeleSoft Ada compiler and found there code optimized
away.  The compiler assumed that anything it does is correct and
therefore it need not check for things that are obviously true. ;)

To it asking whether an enum was between the first legal value
and the last legal value was like asking if an integer object
had a value between integer'First and integer'Last.  The answer
was always yes. 

We found that on our system we must always make explict legalty
checks on the integer representations of data words/registers,etc
(stuff gotten from non-ada, not this Ada program sources). The
way the checks were made depended upon the often weird aspects
of the external devices and how fast something had to be done.

Robert Parkhill

             reply	other threads:[~1993-09-03 19:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-03 19:06 dog.ee.lbl.gov!agate!spool.mu.edu!umn.edu!email.sp.paramax.com!not-for-ma [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-09-04  0:13 Unchecked_Conversion question Robert Dewar
1993-09-03 21:55 Robert Parkhill
1993-09-03 20:14 Wes Groleau x1240 C73-8
1993-09-03 19:51 dog.ee.lbl.gov!agate!howland.reston.ans.net!spool.mu.edu!sdd.hp.com!netwo
1993-09-02 15:43 dog.ee.lbl.gov!overload.lbl.gov!agate!howland.reston.ans.net!noc.near.net
1993-09-02 13:38 Lowell S. VonRuden x5294
1993-09-02  3:00 Robert Dewar
1993-09-01 16:43 dog.ee.lbl.gov!network.ucsd.edu!news.cerf.net!shrike.irvine.com!adam
1993-09-01 15:47 Lowell S. VonRuden x5294
replies disabled

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