TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"Robert I. Eachus" <[log in to unmask]>
Thu, 12 Nov 1998 11:47:44 -0500
text/plain (26 lines)
At 09:58 AM 11/11/98 -0500, W. Wesley Groleau x4923 wrote:
>If your algorithm depends on a type or object having a certain range or
>size, you declare the type or object accordingly, and tell your suppliers
>you can only accept compilers and hardware that will accept your
>declarations.

   It is actually better, if you need a 32-bit Integer type, to declare:

subtype Integer32 is Integer range -2_147_483_648..2_147_483_647;
for Integer32'Size use 32;

   or some such.  The declaration will be rejected in Ada 95 if Integer does
not have the required range, this is a change from Ada 83.  (Of course, it is
possible that you will run into a compiler that supports 32-bit Integer
types, but where Integer is larger.  You can detect that--if it is
important--by adding:

X: Integer;
for X'Size use 32;

                                        Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...

ATOM RSS1 RSS2