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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e08ffaff681705c X-Google-Attributes: gid103376,public From: guerby@gnat.com (Laurent Guerby) Subject: Re: access aliased obstacle Date: 1996/07/09 Message-ID: #1/1 X-Deja-AN: 167462635 sender: guerby@schonberg.cs.nyu.edu references: <4rsmn6$hvc@news1.delphi.com> organization: New York University reply-to: guerby@gnat.com newsgroups: comp.lang.ada Date: 1996-07-09T00:00:00+00:00 List-Id: >> I think of a C union as essentially a variant record with the >> discriminant outside the record (in some other variable entirely). >> C probably does think of this as a union, although it fits an Ada >> discriminated record perfectly. What is this 'Unchecked_Union'? >> I don't see it in my LRM. A discriminated record isn't a C union type, because the discriminant is stored in the record in Ada (accessible for reading), and run-time checks are made on the discriminant when you access variant parts. The pragma Unchecked_Union makes a simple Ada discriminated record type match exactly a C union (discriminant not stored, no checks). It is not in the RM, but all vendors agreed to implement it. It is documented in the GNAT file "features" I think (or gnatinfo.txt). I still assume you're interfacing a C array of union, but I'm not sure, and cannot be more accurate without the code (C and what you want in Ada). -- Laurent Guerby , Team Ada. "Use the Source, Luke. The Source will be with you, always (GPL)."