comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: why can't we declare unconstrained objects ?
Date: Sun, 12 Dec 2004 18:47:18 +0100
Date: 2004-12-12T18:47:18+01:00	[thread overview]
Message-ID: <gfemos7j5yhx$.1xk8qtzdu7s4x$.dlg@40tude.net> (raw)
In-Reply-To: fa59671.0412120743.5cc44da6@posting.google.com

On 12 Dec 2004 07:43:21 -0800, 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

Provide default:

   type thing (what : Boolean := False) is ...

this will make it...

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  parent reply	other threads:[~2004-12-12 17:47 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 [this message]
2004-12-12 18:21 ` Martin Dowie
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