comp.lang.ada
 help / color / mirror / Atom feed
From: "(see below)" <byaldnif@blueyonder.co.uk>
Subject: Re: Bitmanipulation in Ada
Date: Thu, 19 Aug 2004 15:25:20 GMT
Date: 2004-08-19T15:25:20+00:00	[thread overview]
Message-ID: <BD4A8509.96EBD%byaldnif@blueyonder.co.uk> (raw)
In-Reply-To: cg0j9n$bkq$1@sparta.btinternet.com

On 18/8/04 10:56 pm, in article cg0j9n$bkq$1@sparta.btinternet.com, "Martin
Dowie" <martin.dowie@btopenworld.com> wrote:

...
>>> TYPE ov is record
>>> case boolean of
>>>   true : i : integer;
>>>   false  : byte_array;
>>> end;
>>> end;
>>> 
>>> Such overlay structures are not valid with Ada, so what do instead?
>> 
>> Such usages are not valid in (ISO Standard) Pascal either,
>> but you don't let that stop you. 8-)
> 
> Where does the standard deem this "not valid" in Ada?

I'm not sure who Martin is asking, nor what about; but:

If "this" means Pascal-style tagless variant records, see the RM, section
3.8.1 "Variant Parts and Discrete Choices", where no such syntax appears.

If "this" means assigning a value of type T1 to a field F1 of a variant V1
of a record structure R and retrieving a value of type T2 from a field F2 of
a variant V2, "R.F1 := T1_Val; ...; T2_var := R.F2" then:

 (a) If the variant has not been changed from V1 to V2, then a discriminant
     check on access to F2 will raise a Constraint_Error.
 (b) If the variant has been changed to V2, then F2 has been given a new
     value and so does not retain the value placed in F1.
 (c) It cannot even be assumed that F1 and F2 coincide, unless a
      representation specification can be used to that effect.

(I suspect Martin knows all this perfectly well, so I wonder why he asks.)
-- 
Bill Findlay
<surname><forename> chez blueyonder.co.uk




  reply	other threads:[~2004-08-19 15:25 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-18 20:37 Bitmanipulation in Ada Bernd Specht
2004-08-18 20:51 ` Ludovic Brenta
2004-08-18 21:10   ` Bernd Specht
2004-08-18 21:16     ` Ludovic Brenta
2004-08-18 21:18     ` Ed Falis
2004-08-19 17:30       ` Bernd Specht
2004-08-19 17:44         ` Ed Falis
2004-08-19  0:53     ` Jeffrey Carter
2004-08-19 17:44       ` Bernd Specht
2004-08-19 18:09         ` Martin Dowie
2004-08-19 18:28           ` Bernd Specht
2004-08-19 19:31             ` Martin Dowie
2004-08-19 20:29             ` Martin Dowie
2004-08-20 21:31               ` Bernd Specht
2004-08-19 19:17         ` Jeffrey Carter
2004-08-19 19:57           ` Björn Persson
2004-08-20  0:52             ` Jeffrey Carter
2004-08-19 21:24         ` Francois G. Dorais
2004-08-20  8:55           ` Pascal Obry
2004-08-20  7:26         ` Jean-Pierre Rosen
2004-08-20 21:20           ` Bernd Specht
2004-08-20 21:39             ` Ed Falis
2004-08-18 21:14 ` (see below)
2004-08-18 21:56   ` Martin Dowie
2004-08-19 15:25     ` (see below) [this message]
2004-08-19 15:50       ` Martin Dowie
2004-08-18 21:53 ` Martin Dowie
2004-08-18 22:59   ` Björn Persson
2004-08-19  8:08   ` Egil H. H�vik
2004-08-19 17:46   ` Bernd Specht
2004-08-20 20:57 ` Bitordering? was " Alfred Hilscher
2004-08-21 11:34   ` Nick Roberts
2004-08-21 14:00     ` Jim Rogers
2004-08-21 16:54       ` Simon Wright
2004-08-21 16:55     ` Georg Bauhaus
2004-08-23 18:36       ` Alfred Hilscher
2004-08-23 18:47     ` Alfred Hilscher
2004-08-23 22:39       ` Nick Roberts
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox