home *** CD-ROM | disk | FTP | other *** search
- -- Chapter 30 - Program 1
- with Text_IO;
- use Text_IO;
- procedure SmallInt is
-
- package Int_IO is new Text_IO.Integer_IO(INTEGER);
- use Int_IO;
-
- BITS : constant := 1;
- type SMALL_INTEGER is new INTEGER range -25..120;
- for SMALL_INTEGER'SIZE use 8*BITS;
- type BIG_ARRAY is array(1..1000) of SMALL_INTEGER;
-
- Number : SMALL_INTEGER := 27;
- Big_List : BIG_ARRAY;
-
- begin
-
- Put("The type SMALL_INTEGER uses ");
- Put(INTEGER(SMALL_INTEGER'SIZE));
- Put(" bits of memory.");
- New_Line;
-
- Put("The type BIG_ARRAY uses ");
- Put(INTEGER(BIG_ARRAY'SIZE));
- Put(" bits of memory.");
- New_Line;
-
- end SmallInt;
-
-
-
-
- -- Result of execution (as written)
-
- -- The type SMALL_INTEGER uses 8 bits of memory.
- -- The type BIG_ARRAY uses 8000 bits of memory.
-
-
-
- -- Result of execution (with line 11 commented out)
-
- -- The type SMALL_INTEGER uses 16 bits of memory.
- -- The type BIG_ARRAY uses 16000 bits of memory.
-