comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: SET in Ada?
Date: 14 Mar 2003 12:23:44 -0500
Date: 2003-03-14T12:23:44-05:00	[thread overview]
Message-ID: <wccvfylrhen.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 3E7203B0.B5B7E076@alfred-hilscher.de

Alfred <SPAM@alfred-hilscher.de> writes:

> Hi I'm trying to convert some Modula code to Ada. There is a statement
> like this:
> 
> IF i in {1,5,13,21}  THEN ...
> 
> How could this be translated to Ada, because as far as I know, Ada has
> no similar "SET" handling.

The corresponding feature in Ada is a packed array of Booleans:

    type Bit_Set is array(...) of Boolean;
    pragma Pack(Bit_Set);
    Set: constant Bit_Set := (1 | 5 | 13 | 21 => True, others => False);
    if Set(I) then...

- Bob



  parent reply	other threads:[~2003-03-14 17:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-14 16:30 SET in Ada? Alfred
2003-03-14 16:45 ` Jeffrey Creem
2003-03-14 17:23 ` Robert A Duff [this message]
2003-03-15  2:11 ` Jeffrey 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