comp.lang.ada
 help / color / mirror / Atom feed
From: rds@moss.ATT.COM
Subject: unsigned integers in Ada
Date: 20 Apr 88 23:56:48 GMT	[thread overview]
Message-ID: <25160@clyde.ATT.COM> (raw)

How does one implement an unsigned integer in Ada and have a maximum
value equal to 2**(number of bits) in any given implementation?

Is this an oversight or does Ada really limit maximum integer
values to 2**(# of bits MINUS ONE)-1. More verbosely put
declaring 

     type Pointer is range 0..(2**32)-1;
     for Pointer'SIZE use 32;

is invalid for a 32 bit integer implementation because (2**32)-1
is not in the INTEGER'RANGE -(2**31)..(2**31)-1. How can I use the
leftover bit?

     subtype Pointer is INTEGER range 0..(2**32)-1;
     for Pointer'SIZE use 32;

is illegal because it is not a <first named subtype> LRM 13.1 (3)

WHAT IS A FIRST NAMED SUBTYPE?? And can someone give an example?

Any assistance will keep the hair in my head for another day (Ada problem).

             reply	other threads:[~1988-04-20 23:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1988-04-20 23:56 rds [this message]
1988-04-26 14:32 ` unsigned integers in Ada stt
  -- strict thread matches above, loose matches on Subject: below --
1988-04-27  7:30 Gary Morris @flash
replies disabled

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