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-Thread: 103376,32e730fd939a8067 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g49g2000cwa.googlegroups.com!not-for-mail From: invalidemail@aerojockey.com Newsgroups: comp.lang.ada Subject: Re: changing alignment of built-in boolean Date: 14 Oct 2005 16:33:34 -0700 Organization: http://groups.google.com Message-ID: <1129332814.670876.3310@g49g2000cwa.googlegroups.com> References: <1129320236.007525.185300@g44g2000cwa.googlegroups.com> <8764rzhfo0.fsf@ludovic-brenta.org> NNTP-Posting-Host: 65.185.27.25 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1129332819 6169 127.0.0.1 (14 Oct 2005 23:33:39 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 14 Oct 2005 23:33:39 +0000 (UTC) In-Reply-To: <8764rzhfo0.fsf@ludovic-brenta.org> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g49g2000cwa.googlegroups.com; posting-host=65.185.27.25; posting-account=ic31RQwAAADG2g1NjWUVIsXdf0Dq_CbQ Xref: g2news1.google.com comp.lang.ada:5670 Date: 2005-10-14T16:33:34-07:00 List-Id: Ludovic Brenta wrote: > invalidemail@aerojockey.com writes: > > > Is it possible, in GNAT, to force the built-in Boolean type to use > > 4-byte (32-bit) alignment? Reason: I have to interface some Ada code > > to a package that insists on 32-bit variables on 4-byte-aligned > > addresses. > > > > Feel free to suggest some other strategy for accomplishing this, though > > I'd prefer not to make extensive changes to the Ada code (such as > > changing it to use a subtype of Boolean). > > > > I'm using GNAT 3.15p on HPUX. > > > > Thanks. > > type T is record > B : Boolean; > ... > end record; > > for T use record > B at 0 range 0 .. 31; > ... > end record; > > package P is > subtype External_Boolean is Boolean; > for External_Boolean'Size use 32; > for External_Boolean'Alignment use 32; Parenthetically, I tried this. Compiler told me I cannot specify attribute for subtype. > procedure External (B : in External_Boolean); > pragma Import (C, External, "some_function"); > end P; Ok, I'm sorry. I appear to have omitted a crucial piece of information: this is for library level Booleans. The Ada code constitutes a shared library, and the program that calls the library accesses some of the library level variables via the symbol table, but the variables have to be 32-bits. The record way doesn't work either, at least not without extensive changes, because I still have to use these variables as Booleans (in conditional expressions). I was thinking that if there was a way to do this it would be to use some compiler flag or an obscure, implementation-defined pragma. Thanks anyways. :)