From: AdaMagica <christ-usch.grein@t-online.de>
Subject: Re: A hole in Ada type safety
Date: Thu, 12 May 2011 22:31:17 -0700 (PDT)
Date: 2011-05-12T22:31:17-07:00 [thread overview]
Message-ID: <e65e701b-0466-4924-8912-f053037c16a7@k22g2000yqh.googlegroups.com> (raw)
In-Reply-To: iqhv23$bd5$1@speranza.aioe.org
On 13 Mai, 02:47, a...@att.net wrote:
> --
> -- May be this program will help explain the problem.
> --
(erased a lot of irrelevant stuff)
> -- ------------------ --
> -- Ada05_Conversion --
> -- ------------------ --
> generic
> type Source (<>) is limited private ;
> type Target (<>) is limited private ;
> function Ada05_Conversion ( S : Source ) return Target ;
>
> function Ada05_Conversion ( S : Source ) return Target is
>
> pragma Suppress ( All_Checks ) ;
>
> begin
> -- Compiling Error messages:
> -- (Ada 2005) cannot copy object of a limited type
> -- (RM-2005 6.5(5.5/2))
> -- consider switching to return of access type
> --
> -- Additional References for reasoning:
> -- RM 7.5 Limited Types ( 1/2, 1.a, 1.b/2 )
> --
> return Target ( S ) ;
What you are writing here is a normal type conversion with certain
rules (RM 4.6), not an unchecked type conversion (RM 13.9). For a type
conversion to be legal, the types involved have to be convertible.
Source and Target are not convertible, so this whole thing is illegal
for several reasons.
> end Ada05_Conversion ;
RTFM
next prev parent reply other threads:[~2011-05-13 5:31 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-30 8:41 A hole in Ada type safety Florian Weimer
2011-04-30 11:56 ` Robert A Duff
2011-04-30 15:27 ` Gavino
2011-04-30 16:16 ` Florian Weimer
2011-04-30 23:39 ` Randy Brukardt
2011-05-01 10:26 ` Florian Weimer
2011-05-03 1:40 ` Randy Brukardt
2011-05-03 16:57 ` Robert A Duff
2011-05-07 9:09 ` Florian Weimer
2011-05-07 9:28 ` Dmitry A. Kazakov
2011-05-07 9:57 ` Florian Weimer
2011-05-08 8:08 ` Dmitry A. Kazakov
2011-05-08 8:46 ` Florian Weimer
2011-05-08 9:32 ` Dmitry A. Kazakov
2011-05-08 10:30 ` Florian Weimer
2011-05-08 20:24 ` anon
2011-05-08 21:11 ` Simon Wright
2011-05-10 6:27 ` anon
2011-05-10 14:39 ` Adam Beneschan
2011-05-11 20:39 ` anon
2011-05-12 0:51 ` Randy Brukardt
2011-05-13 0:47 ` anon
2011-05-13 0:58 ` Adam Beneschan
2011-05-13 5:31 ` AdaMagica [this message]
2011-05-12 5:51 ` AdaMagica
2011-05-12 12:09 ` Robert A Duff
2011-05-12 14:40 ` Adam Beneschan
2011-05-14 0:30 ` Randy Brukardt
2011-05-09 7:48 ` Dmitry A. Kazakov
2011-05-09 20:41 ` Randy Brukardt
2011-05-14 23:47 ` anon
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox