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!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!irazu.switch.ch!news-zh.switch.ch!switch.ch!news.hispeed.ch!linux2.krischik.com!news From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: changing alignment of built-in boolean Date: Sat, 15 Oct 2005 09:13:36 +0200 Organization: Cablecom Newsserver Message-ID: <6352843.iZBs4xBJdn@linux1.krischik.com> References: <1129320236.007525.185300@g44g2000cwa.googlegroups.com> <8764rzhfo0.fsf@ludovic-brenta.org> <1129332814.670876.3310@g49g2000cwa.googlegroups.com> NNTP-Posting-Host: 84-73-3-231.dclient.hispeed.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.hispeed.ch 1129361402 21628 84.73.3.231 (15 Oct 2005 07:30:02 GMT) X-Complaints-To: news@hispeed.ch NNTP-Posting-Date: Sat, 15 Oct 2005 07:30:02 +0000 (UTC) User-Agent: KNode/0.9.2 Xref: g2news1.google.com comp.lang.ada:5680 Date: 2005-10-15T09:13:36+02:00 List-Id: invalidemail@aerojockey.com wrote: > 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. >> 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. A typo from Ludovic. you really need: type External_Boolean is new Boolean; for External_Boolean'Size use 32; for External_Boolean'Alignment use 32; Of corse you need an explicit convertion between Boolean and External_Boolean. > 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. External_Boolean will work fine for that. > 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. :) Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com