> From: [log in to unmask] > i had a small doubt regarding the size occupied by the variable of a > boolean type. > x : boolean; > begin > put(boolean'size); -- it is giving 1 bit > put(x'size); -- it is returning 8 bits > end > > why is it so? 'Size is the minimum required, clearly a Boolean will fit in 1 bit if it's packed in. However, if the compiler can generate more efficient code by putting actual instances in a byte (or more) it can do so. X'Size is the size of the actual object, 8 bits -> 1 byte. If X'Size was 1, what would the compiler do with the other 7 bits in the byte, given it probably couldn't use them for anything else? You might look in the ALRM for 'Max_Size_In_Storage_Elements or in the GNAT documentation for 'Object_Size. > actuallly i want to type cast a array of boolean type into an integer > value. > > type arr_type is array(integer range 1..2) of boolean; > > function uncheck is new unchecked_conversion(arr_type,integer); > > a(1) := TRUE > a(2) := TRUE > > when converted, the value i am getting is 257 instead of 3 I guess you are running on an Intel machine? (probably not a VAX or an Alpha). You have 2 array elements each of one byte, each with value 1 (for True), 256*1 + 1 -> 257. Didn't your compiler complain about the other 2 bytes? (most compilers use 4 byte Integers nowadays). Check out pragma Pack and the record representation attributes (ALRM 13.5.1). I do wonder just what you're trying to achieve with this code, sounds very un-Adaish.