comp.lang.ada
 help / color / mirror / Atom feed
From: invalidemail@aerojockey.com
Subject: Re: changing alignment of built-in boolean
Date: 16 Oct 2005 10:48:15 -0700
Date: 2005-10-16T10:48:15-07:00	[thread overview]
Message-ID: <1129484895.726188.61070@g44g2000cwa.googlegroups.com> (raw)
In-Reply-To: <Nv14f.1603$hY6.1538@newsread1.news.pas.earthlink.net>


Jeffrey R. Carter wrote:
> invalidemail@aerojockey.com wrote:
> > 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.
>
> You could always modify the compiler :)
>
> You might want to look at user-defined boolean types here (it's sometimes a
> little confusing in Ada to distinguish between integer types and type Integer,
> character types and type Character, string types and type String, boolean types
> and type Boolean):
>
> type Big_Boolean is new Boolean;
> for Big_Boolean'Size use 32;
> for Big_Boolean'Alignment use 4;
>
> Conditions can be of any boolean type, so you can use this just like type Boolean:

Yes, but there appears to be one little catch:

   if B and then (Some_Integer /= 0) then ...

Unfortunately I got stuff like this all over the Ada code :(  Otherwise
this would be something I could do with a simple search and replace.
Maybe there's a flag to loosen the type checking for this case.
Probably not.  Oh well.

Thanks.




  reply	other threads:[~2005-10-16 17:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-14 20:03 changing alignment of built-in boolean invalidemail
2005-10-14 22:55 ` Ludovic Brenta
2005-10-14 23:33   ` invalidemail
2005-10-15  7:13     ` Martin Krischik
2005-10-17 18:02       ` Jean-Pierre Rosen
2005-10-14 23:29 ` tmoran
2005-10-15  1:39 ` Steve
2005-10-15  6:45   ` Jeffrey R. Carter
2005-10-15  6:40 ` Jeffrey R. Carter
2005-10-16 17:48   ` invalidemail [this message]
2005-11-09  3:25   ` Anonymous Coward
2005-11-09  5:42     ` christoph.grein
2005-11-09 22:14     ` Jeffrey R. Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox