From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ec264956a9d7e36a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-11 10:07:18 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.cwix.com!news.binc.net!kilgallen From: Kilgallen@SpamCop.net (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: Restrictions on compilers for Microsoft's .NET project Date: 11 Feb 2002 12:07:05 -0600 Organization: LJK Software Message-ID: <6Hi6zB5TJ9qK@eisner.encompasserve.org> References: <2sk5nInklHl1@eisner.encompasserve.org> <3c680086@pull.gecm.com> NNTP-Posting-Host: eisner.encompasserve.org X-Trace: grandcanyon.binc.net 1013450836 17385 192.135.80.34 (11 Feb 2002 18:07:16 GMT) X-Complaints-To: abuse@binc.net NNTP-Posting-Date: Mon, 11 Feb 2002 18:07:16 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:19877 Date: 2002-02-11T12:07:05-06:00 List-Id: In article <3c680086@pull.gecm.com>, "Martin Dowie" 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 ?