From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: Pure, Storage_Size and Unchecked_Conversion
Date: Sun, 08 Jul 2007 18:08:02 +0200
Date: 2007-07-08T18:08:02+02:00 [thread overview]
Message-ID: <1636644.syfCPdaSFI@linux1.krischik.com> (raw)
In-Reply-To: 1183854255.792142.110150@i38g2000prf.googlegroups.com
Y.Tomino wrote:
> Hi.
> I compiled the package like this with gcc 4.2.
>
> with Ada.Unchecked_Conversion;
> package Pure_SS_Unc is
> pragma Pure;
> type T is access Integer;
> for T'Storage_Size use 0;
> function F1 (X : Integer) return T;
> function F2 is new Ada.Unchecked_Conversion (Integer, T);
> end Pure_SS_Unc;
You are aware that this will only work on 32 bit system while 64 bit is the
future. It does - of course - not mean that you can't do it. You just have
to do it right.
Read:
http://en.wikibooks.org/wiki/Ada_Programming/Types/access#Where_is_void.2A.3F
In short: don't use the predefined integer - use your own:
type void is mod System.Memory_Size;
for void'Size use System.Word_Size;
> pure_ss_unc.ads:7:58: named access types not allowed in pure unit
It's one of the definitions of a pure unit: no named access types. It you
read the Distributed System Annex then you will see why it has to be that
way.
Martin
--
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com
next prev parent reply other threads:[~2007-07-08 16:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-08 0:24 Pure, Storage_Size and Unchecked_Conversion Y.Tomino
2007-07-08 9:49 ` Georg Bauhaus
2007-07-08 10:41 ` Y.Tomino
2007-07-08 16:08 ` Martin Krischik [this message]
2007-07-09 13:31 ` Y.Tomino
2007-07-09 21:31 ` Georg Bauhaus
2007-07-10 1:35 ` Randy Brukardt
2007-07-10 8:30 ` Georg Bauhaus
2007-07-15 17:30 ` Y.Tomino
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox