comp.lang.ada
 help / color / mirror / Atom feed
From: slinky.cs.nyu.edu!slinky.cs.nyu.edu!nobody@nyu.edu  (Robert Dewar)
Subject: Re: Unchecked_Conversion question
Date: 4 Sep 93 00:13:10 GMT	[thread overview]
Message-ID: <268mim$28v@schonberg.cs.nyu.edu> (raw)

Wes makes an incorrect assumption that a compiler is not free to assume
that the output of unchecked conversion is valid. Since a program execution
is erroneous if the value is not valid, the compiler is free to do anything
it wants in this case, and in particular it can skip the check which seems
to be otherwise required.

It is this same freedom which allows A:= B to skip a check if A and B
are the same subtype. The check is required by the RM even in the case
of the values being the same subtype (that's because the value of B is
just a value of the base type, and assignment to A always requires a 
check that the value of the base type meets its constraints).

The only case however if the subtypes are the same, where the check could
really be needed is if B is uninitialized, but then the program is erroneous
anyway, so the compiler can omit the check (and most all compilers do in this
case, maybe all).

Ada 9X cleans up a lot of these issues with its introduction of the notion of
a bounded error. This is an error which is not necesssarily detected, but 
unlike the erronoues case, there are a limited set of consequences.

             reply	other threads:[~1993-09-04  0:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-04  0:13 Robert Dewar [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-09-03 21:55 Unchecked_Conversion question 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-03 19:06 dog.ee.lbl.gov!agate!spool.mu.edu!umn.edu!email.sp.paramax.com!not-for-ma
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