comp.lang.ada
 help / color / mirror / Atom feed
From: mazzanti@iei.pi.cnr.it (Franco Mazzanti)
Subject: Re: Rules for Representation of Subtypes
Date: 1996/10/03
Date: 1996-10-03T00:00:00+00:00	[thread overview]
Message-ID: <mazzanti-0310961743320001@131.114.200.115> (raw)


Robert A Duff wrote:

> >generic
> >   type Source(<>) is limited private;
> >   type Target is (<>);
> >function Checked_Scalar_Conversion (S:Source) return Target; 
> >
> >
> >with Unchecked_Conversion;
> >function Checked_Scalar_Conversion (S : Source) return Target is
> >   type My_Rec is record
> >      Scalar : Target;
> 
> That's illegal, since Target has unknown discrims.  But other than that,
> this approach will work.
> 
> But, you don't really need to go to all that trouble.  If you just make
> sure your integer types match the hardware (like -2**31..2**31-1 or
> whatever), then unchecked conv of integers will tend to work just fine.
>  ...
>  ...
> 
> - Bob

illegal? isn't Target required to be just a discrete type [RM 12.5.2(2)]?
If I am wrong, is this a GNAT bug (since it compiles without problem)?

Notice that all this trouble might be needed if I want my program to be
as far as possible implementation-independent, or if I want to look for
same mechanically verifiable (as far as possible implementation-independent)
safe coding guidelines (without going to disallow all unchecked conversions).

Franco




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

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-03  0:00 Franco Mazzanti [this message]
1996-10-03  0:00 ` Rules for Representation of Subtypes Robert A Duff
  -- strict thread matches above, loose matches on Subject: below --
1996-10-10  0:00 W. Wesley Groleau (Wes)
1996-10-10  0:00 ` Robert Dewar
1996-10-11  0:00 ` Ken Garlington
1996-10-02  0:00 Franco Mazzanti
1996-10-03  0:00 ` Robert A Duff
1996-09-28  0:00 Robert Dewar
1996-09-29  0:00 ` Robert A Duff
1996-09-29  0:00   ` Matthew Heaney
1996-09-28  0:00 Robert Dewar
1996-09-30  0:00 ` Keith Thompson
1996-09-28  0:00 Robert Dewar
1996-09-29  0:00 ` Robert A Duff
1996-09-29  0:00   ` Matthew Heaney
1996-09-29  0:00   ` Robert Dewar
1996-09-30  0:00     ` Art Schwarz
1996-09-30  0:00       ` Robert A Duff
1996-10-01  0:00       ` Larry Kilgallen
1996-10-01  0:00         ` Brian R. Hanson
1996-10-01  0:00         ` Robert A Duff
1996-09-22  0:00 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                 ` Robert A Duff
1996-10-01  0:00                 ` Samuel Tardieu
1996-10-01  0:00                   ` Ken Garlington
1996-09-28  0:00           ` Larry Kilgallen
1996-09-29  0:00             ` Robert A Duff
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-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-10-03  0:00             ` Robert Dewar
1996-09-27  0:00       ` Matthew Heaney
1996-09-27  0:00         ` Robert A Duff
1996-09-23  0:00 ` David C. Hoos, Sr.
1996-09-23  0:00   ` Robert A Duff
1996-09-23  0:00   ` Samuel T. Harris
1996-09-26  0:00     ` David C. Hoos, Sr.
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 A Duff
1996-09-27  0:00           ` Robert Dewar
1996-09-27  0:00         ` Robert Dewar
1996-09-27  0:00       ` Robert A Duff
1996-09-24  0:00   ` 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