From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ae9451f54a74fd7b X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: array question Date: 1999/01/19 Message-ID: #1/1 X-Deja-AN: 434325783 Sender: matt@mheaney.ni.net References: <78189o$2bj@eng-ser1.erg.cuhk.edu.hk> NNTP-Posting-Date: Mon, 18 Jan 1999 23:24:13 PDT Newsgroups: comp.lang.ada Date: 1999-01-19T00:00:00+00:00 List-Id: ycli6@se.cuhk.edu.hk (yukchi) writes: > hihi, > i want to ask a question in array. > type MY_ARRAY is array(INTEGER range <>) of FLOAT; > > what is the meaning of <>, also can i replace INTEGER with > other type? such as FLOAT, BOOLEAN? > > Thanks! > > -- > **** **** ** ** ** ** ** ** ** ** ** ** ** > **** ****** *** *** ** ** ** ** ** ** ** ** ** > ** ** ** ******** ** ** ** ** ** ** ** ** ** > ** ****** ******** **** ** ** **** ** ** ** > ** ****** ** ** ** ** ** ** ** ** ** ** ** > ** ** ** ** ** ** ** ** ** ** > **** ** ** ** ** ** ********* ** ** ** ** ** > **** ** ** ** ** ** ***** ** ** ** ** ** Yes, you are Yuk. Please get rid of this signature. It is very annoying. The "<>" is refered to as "box." It means that information has been omitted. Here, in your array declaration, it means that you are omitted index constraints in the type. Objects of that type can have any index constraints: procedure Op (X : in My_Array) is begin ... X'First can be any value in type Integer ... X'Last can be any value in type Integer However, compare that with subtype Matts_Array is My_Array (1 .. 10); Now we have declared a subtype that constrains the index of the base type My_Array. We could do something similar using a completely different type: type Matts_Array is array (Integer range 1 .. 10) of Float; Objects of (sub)type Matts_Array all have index values such that X'First is 1, and X'Last is 10. An array can be indexed by any discrete type (integer types or enumeration types). That means Float is not acceptable, becuase that type is a floating point type, not a discrete type. However, Boolean is acceptable, becuase it is a discrete type. Please get rid of your annoying signiture.