From: Martin Dowie <martin.dowie@btopenworld.com>
Subject: Re: why can't we declare unconstrained objects ?
Date: Sun, 12 Dec 2004 18:21:45 +0000 (UTC)
Date: 2004-12-12T18:21:45+00:00 [thread overview]
Message-ID: <cpi27p$2ft$1@titan.btinternet.com> (raw)
In-Reply-To: <fa59671.0412120743.5cc44da6@posting.google.com>
Michael Mounteney wrote:
> Is there a simple way in Ada of simulating C/C++ unions ? It seems to
> me that this is gratuitously prevented, that is, it can be done with
> safety, by extending an existing run-time check, but it is in fact
> prevented by the compiler.
>
> Hopefully the following commented source will illustrate my point.
>
> with Ada.text_IO;
>
> procedure unconstrained is
>
> -- Very simple discriminated type
> type thing (what : Boolean) is
Simply add a default to the discriminant and you can change it all you
want at run-time (e.g. "what : Boolean := Boolean'First").
Cheers
-- Martin
next prev parent reply other threads:[~2004-12-12 18:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-12 15:43 why can't we declare unconstrained objects ? Michael Mounteney
2004-12-12 17:39 ` Martin Krischik
2004-12-12 17:47 ` Dmitry A. Kazakov
2004-12-12 18:21 ` Martin Dowie [this message]
2004-12-12 18:40 ` Jeffrey Carter
2004-12-12 19:24 ` Dmitry A. Kazakov
2004-12-15 13:39 ` David Botton
2004-12-15 21:47 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox