comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Valid Attribute and Unchecked Conversion
Date: 1996/10/02
Date: 1996-10-02T00:00:00+00:00	[thread overview]
Message-ID: <Dynt6I.5D1@world.std.com> (raw)
In-Reply-To: mheaney-ya023180000110962027510001@news.ni.net


In article <mheaney-ya023180000110962027510001@news.ni.net>,
Matthew Heaney <mheaney@ni.net> wrote:
>So it's legal to check (using the valid attribute) the value of a (scalar)
         ^^^^^ you me "not erroneous".
>object with an invalid representation, right?

Right.

>Given the following program:
>
>   declare
>      type T is range 1 .. 10;
>      function To_T is new Unchecked_Conversion (Integer, T);
>      O : constant T := To_T (0);

I can't read that clearly on my screen, but I assume the variable name
is the letter oh, and the expression is the number zero.  ;-)

>   begin
>      if O'Valid then
>         ...
>   end;
>
>I want to know if the program is correct.  Is it erroneous, yes or no?

This is essentially the same as the example in 13.9.1(12.d), which I
posted a couple of days ago.  It is erroneous, by 13.9.1(12).  This has
nothing to do with the 'Valid attribute -- the above program becomes
erroneous before it gets to the 'Valid.  What I mean is, it's not that
'Valid doesn't work.  It's that Unchecked_Conversion is explicitly
defined to be erroneous in the above case.

Note that the rules for I/O are somewhat different than for
unchecked_conversion, primarily because function results are different
from 'out' parameters.

- Bob




  reply	other threads:[~1996-10-02  0:00 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-22  0:00 Rules for Representation of Subtypes Matthew Heaney
1996-09-23  0:00 ` Robert A Duff
1996-09-24  0:00   ` Matthew Heaney
1996-09-26  0:00     ` Robert A Duff
1996-09-26  0:00       ` Larry Kilgallen
1996-09-27  0:00         ` Robert A Duff
1996-09-27  0:00           ` Mark A Biggar
1996-09-30  0:00             ` Robert A Duff
1996-10-01  0:00               ` Larry Kilgallen
1996-10-01  0:00                 ` Samuel Tardieu
1996-10-01  0:00                   ` Ken Garlington
1996-10-01  0:00                   ` Valid Attribute and Unchecked Conversion Matthew Heaney
1996-10-02  0:00                     ` Robert A Duff [this message]
1996-10-04  0:00                       ` Keith Thompson
1996-10-04  0:00                         ` Robert A Duff
1996-10-04  0:00                           ` Robert Dewar
1996-10-11  0:00                             ` Norman H. Cohen
1996-10-12  0:00                               ` Robert Dewar
1996-10-06  0:00                           ` Keith Thompson
1996-10-07  0:00                             ` Robert Dewar
1996-10-09  0:00                               ` Keith Thompson
1996-10-07  0:00                           ` Ken Garlington
1996-10-08  0:00                           ` Alan Brain
1996-10-04  0:00                         ` Matthew Heaney
1996-10-07  0:00                           ` Robert Dewar
1996-10-09  0:00                             ` Keith Thompson
1996-10-07  0:00                         ` Robert Dewar
1996-10-10  0:00                           ` Ken Garlington
1996-10-11  0:00                             ` Robert Dewar
1996-10-14  0:00                               ` Keith Thompson
1996-10-14  0:00                               ` Ken Garlington
1996-10-07  0:00                         ` Kenneth Almquist
1996-10-01  0:00                 ` Rules for Representation of Subtypes Robert A Duff
1996-09-28  0:00           ` Larry Kilgallen
1996-09-29  0:00             ` Robert A Duff
1996-09-29  0:00               ` Larry Kilgallen
1996-09-29  0:00                 ` Matthew Heaney
1996-09-30  0:00                 ` Robert A Duff
1996-10-01  0:00                   ` Ken Garlington
1996-10-02  0:00                     ` Robert A Duff
1996-10-02  0:00                       ` Ken Garlington
1996-10-06  0:00                   ` Robert Dewar
1996-09-29  0:00               ` Matthew Heaney
1996-09-30  0:00                 ` Robert A Duff
1996-09-30  0:00                 ` Robert Dewar
1996-09-30  0:00                   ` Matthew Heaney
1996-10-03  0:00             ` Robert Dewar
1996-10-02  0:00         ` Valid Attribute and Unchecked Conversion Robert I. Eachus
1996-10-02  0:00           ` Matthew Heaney
1996-10-02  0:00         ` George Haddad
1996-10-03  0:00           ` John Herro
1996-10-04  0:00             ` Karl Cooper {46901}
1996-10-07  0:00               ` Mark A Biggar
1996-10-08  0:00                 ` Robert Dewar
1996-10-05  0:00             ` Robert Dewar
1996-10-06  0:00               ` Keith Thompson
1996-10-14  0:00                 ` Robert A Duff
1996-09-27  0:00       ` Rules for Representation of Subtypes Matthew Heaney
1996-09-27  0:00         ` Robert A Duff
1996-09-23  0:00 ` David C. Hoos, Sr.
1996-09-23  0:00   ` Samuel T. Harris
1996-09-26  0:00     ` David C. Hoos, Sr.
1996-09-23  0:00   ` Robert A Duff
1996-09-24  0:00   ` Robert Dewar
1996-09-24  0:00   ` Robert Dewar
1996-09-26  0:00     ` Keith Thompson
1996-09-26  0:00       ` Matthew Heaney
1996-09-27  0:00         ` Robert Dewar
1996-09-27  0:00         ` Robert A Duff
1996-09-27  0:00           ` Robert Dewar
1996-09-27  0:00       ` Robert A Duff
  -- strict thread matches above, loose matches on Subject: below --
1996-10-03  0:00 Valid Attribute and Unchecked Conversion Franco Mazzanti
1996-10-04  0:00 Franco Mazzanti
replies disabled

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