comp.lang.ada
 help / color / mirror / Atom feed
From: synoptik@home.com (A. Logue)
Subject: Re: Byte-level to Bit-level Boolean Encoding
Date: 2000/04/01
Date: 2000-04-01T00:00:00+00:00	[thread overview]
Message-ID: <8F08DAE4Dsynoptikdamudderfuck@news> (raw)
In-Reply-To: 8c3ep7$v7c$1@nnrp1.deja.com

robert_dewar@my-deja.com (Robert Dewar) wrote in 
<8c3ep7$v7c$1@nnrp1.deja.com>:

>In article <20000330212836.00305.00000103@ng-fh1.aol.com>,
>  maggiejohn@aol.com (MaggieJohn) wrote:
>
>> type valid_roles is array (1..32) of boolean;
>> pragma pack valid_roles;
>> for valid_roles'size use 32;
>> -- check the syntax here, I'm doing this from memory
>
>ooops, memory parity error :-)
>
>The syntax of the pragma is indeed incorrect of course!

Nevertheless I managed to code it properly and Maggie's solution is far 
better than my own attempt.  At least the code analyzed properly after a 
bit.  (ran into an interesting bit of Ada trivia dealing with array 
constraints - I didn't know that if you constrained an array with an 
enumeration type, you specified the index data type as well as the size of 
the array.  I thought it would always be array(0), array(1), etc.)

As a unrelated side note, the Ada syntax for an array index has always 
bugged me.  Pascal was my first language, so I like the [] syntax instead.  
This preference has been enforced by learning C/C++ and Java, and when I 
first started reading Ada source code, whenever I saw "array(whatever)" I 
kept thinking that it was procedure or function call!  (as it would look 
without using named parameter passing.)

Cheers,
Andrew.






      reply	other threads:[~2000-04-01  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-31  0:00 Byte-level to Bit-level Boolean Encoding Andrew Logue
2000-03-31  0:00 ` MaggieJohn
2000-04-01  0:00   ` Robert Dewar
2000-04-01  0:00   ` Robert Dewar
2000-04-01  0:00     ` A. Logue [this message]
replies disabled

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