comp.lang.ada
 help / color / mirror / Atom feed
From: Kilgallen@SpamCop.net (Larry Kilgallen)
Subject: Re: Restrictions on compilers for Microsoft's .NET project
Date: 11 Feb 2002 12:07:05 -0600
Date: 2002-02-11T12:07:05-06:00	[thread overview]
Message-ID: <6Hi6zB5TJ9qK@eisner.encompasserve.org> (raw)
In-Reply-To: 3c680086@pull.gecm.com

In article <3c680086@pull.gecm.com>, "Martin Dowie" <martin.dowie@nospam.baesystems.com> writes:
>> Note that this says that non-overlapped variants are ok. Ada only
>> allows non-overlapped variants.
> 
> er, shurely shome mishtake?...
> 
> it does allow them to be overlapping (via 'Size or a rep spec) but
> e.g.
>    type A_Variant (Value : Foo := Foo'First) is record
>       case Value is
>          when Bar1 =>
>             Int : Integer;
>          when Bar2 =>
>             Bool : Boolean;
>       end case;
>    end record;
>    for A_Variant'Size use 64;
> 
> but you do have to make a positive decision to do it and to do
> and you can't just change to the other variant without again
> doing something explicit (e.g. uncheck conversion, or a whole
> record assignment).

Certainly I am not expecting to be able to change variants on the fly,
but I have a lot of code that receives an access value denoting a
record and I have to check the value of a discriminant to determine
which fields of the record are available to me.  If I get it wrong
Compaq Ada will detect my error just as surely as it will detect an
out-of-range value of the discriminant.  Those possibly-present
fields from various variants are located at the same offsets as
each other.

The Microsoft publication I quoted described this as "unsafe".  Is
this prohibited by .NET ?  Is it allowed in Ada95 as in Ada83 ?



  reply	other threads:[~2002-02-11 18:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-09 23:31 Restrictions on compilers for Microsoft's .NET project Larry Kilgallen
2002-02-10  5:26 ` Britt Snodgrass
2002-02-11 16:59 ` Stephen Leake
2002-02-11 17:25   ` Larry Kilgallen
2002-02-11 17:34   ` Martin Dowie
2002-02-11 18:07     ` Larry Kilgallen [this message]
2002-02-11 19:20       ` Martin Dowie
2002-02-11 19:31   ` Jerry Petrey
2002-02-12  2:21     ` Robert Dewar
2002-02-12  3:22       ` Larry Kilgallen
2002-02-12 16:33         ` Stephen Leake
2002-02-12 19:26           ` Larry Kilgallen
2002-02-13  2:00         ` Richard Riehle
replies disabled

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