comp.lang.ada
 help / color / mirror / Atom feed
From: wheeler@aphrodite.csed.ida.org (David Wheeler)
Subject: Re: Booelan Function and sizeof operator
Date: 1996/04/12
Date: 1996-04-12T00:00:00+00:00	[thread overview]
Message-ID: <4kmns4$9bg@dmsoproto.ida.org> (raw)
In-Reply-To: Pine.SOL.3.91.960410173604.18640A-100000@unixa.lancs.ac.uk

EMANUELE COSTA (costa@UNIX.LANCS.AC.UK) wrote:
: Hi everybody,
:         I would like to know, if I can find something similar to the C
: sizeof operator and  boolean functions on integer  in Ada. If
: this is not the case how could I write something equal in Ada?


sizeof(int)  ===>   Integer'Size

I'm not sure what you mean by "boolean functions on integer".
If you want to _convert_ a Boolean to Integer, you can use 'Pos:

bool x;                   ==> X : Boolean;
printf("%d", (int) x);        Put(X'Pos);

If you mean "and", "or", etc., you can define a packed array of Booleans
and perform operations on the array.  In Ada 95, you can also use
modular types for "and", "or", etc.


--- David A. Wheeler
Net address: wheeler@ida.org




  parent reply	other threads:[~1996-04-12  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-10  0:00 Booelan Function and sizeof operator EMANUELE COSTA
1996-04-10  0:00 ` Robert Dewar
1996-04-11  0:00 ` Dale Stanbrough
1996-04-12  0:00 ` David Wheeler [this message]
1996-04-13  0:00 ` Samuel Tardieu
1996-04-15  0:00 ` George Haddad
replies disabled

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