comp.lang.ada
 help / color / mirror / Atom feed
From: Anonymous Coward <spam@spam.com>
Subject: Re: changing alignment of built-in boolean
Date: Wed, 09 Nov 2005 03:25:51 GMT
Date: 2005-11-09T03:25:51+00:00	[thread overview]
Message-ID: <slrndn323s.lo7.bogus_addy@tango.mindfuq.org> (raw)
In-Reply-To: Nv14f.1603$hY6.1538@newsread1.news.pas.earthlink.net

In article <Nv14f.1603$hY6.1538@newsread1.news.pas.earthlink.net>, Jeffrey R. Carter wrote:
> 
> 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:
> 
> B : Big_Boolean;
> 
> if B then ...
> 
> while B loop ...
> 
> exit Some_Loop when B;

I tried this, and where I had problems was trying to assign the result
of a boolean expression to Big_Boolean.  ie. Compiling:

   procedure Big_Boolean_Experiment is

      type Big_Boolean_Type is new Boolean;

      --The following line is probably useless on booleans:
      pragma Convention (Convention => C,
                         Entity     => Big_Boolean_Type);

      for Big_Boolean_Type'Size use 32;

      Big_Boolean    : Big_Boolean_Type;
      Native_Boolean : Boolean;

   begin

      Big_Boolean    := 2=2; --gnat rejects this line
      Native_Boolean := 2=2;

   end Big_Boolean_Experiment;

results in this error from gnat:

   $ gcc -c -gnatR3 big_boolean_experiment.adb
   big_boolean_experiment.adb:14:23: expected type "Big_Boolean_Type" defined at line 3
   big_boolean_experiment.adb:14:23: found type "Standard.Boolean"

   $ gcc --version
   gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)



  parent reply	other threads:[~2005-11-09  3:25 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
2005-11-09  3:25   ` Anonymous Coward [this message]
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