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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3f40769e2c517713 X-Google-Attributes: gid103376,public From: evans@evans.pgh.pa.us (Arthur Evans Jr) Subject: Re: Unchecked_Union Date: 1996/02/27 Message-ID: #1/1 X-Deja-AN: 141311449 references: organization: Ada Consulting newsgroups: comp.lang.ada Date: 1996-02-27T00:00:00+00:00 List-Id: In article , dewar@cs.nyu.edu (Robert Dewar) wrote: > The following is a description of pragma Unchecked_Union as we are > implementing it in GNAT. This description is compatible with the > current Intermetrics usage in their binding generator tool. This looks most interesting. Two small comments: > Also, equality and inequality operations on unchecked_unions are not > available, since there is no discriminant to compare, and in general > the compiler does not even know how many bits to compare. It is > implementation dependent whether this is detected at compile time > as an illegality, or whether it is undetected and considered to be > an erroneous construct. In GNAT, a direct comparison is illegal, > but GNAT does not attempt to catch the composite case (where two > composites are compared that contain an unchecked union component), > so such comparisons are simply considered erroneous. My quibble is with the last quoted word. I think you could safely say that this is a bounded error, since the only effect is that the comparison will give the wrong answer. > The layout of the resulting type corresponds exactly to a C union, > ... I wonder whether or not that is a well-defined statement. That is, is the layout a a C union specified anywhere, even for a specific C implementation? (Maybe this comment is off the wall -- I'm not much of a C programmer.) Art Evans Arthur Evans Jr, PhD Phone: 412-963-0839 Ada Consulting FAX: 412-963-0927 461 Fairview Road Pittsburgh PA 15238-1933 evans@evans.pgh.pa.us