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,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,85ee038f08622eb8 X-Google-Attributes: gid103376,public From: johnherro@aol.com (John Herro) Subject: Re: Array Literals? Date: 1996/08/13 Message-ID: <4uq1jb$gpu@newsbf02.news.aol.com>#1/1 X-Deja-AN: 173917465 sender: root@newsbf02.news.aol.com references: <4uo9b6$qj1@Masala.CC.UH.EDU> organization: America Online, Inc. (1-800-827-6364) newsgroups: comp.lang.ada Date: 1996-08-13T00:00:00+00:00 List-Id: cosc19z5@Bayou.UH.EDU (Spasmo) asks if the following will work with any standard Ada compiler: > type Int_Array is array(Integer range <>) of Integer; > procedure Print_Int_Array ( I_List : Int_Array ); > Print_Int_Array ( (1, 2, 3, 4) ); Surely! That's standard Ada. But there's one caution. In your simple example, there's only one procedure called Print_Int_Array, and thus, when the compiler sees the call, it knows that the aggregate (1,2,3,4) must be of type Int_Array, and there's no problem. If you had had several overloaded procedures with that name, each taking a different type, and if the aggregate (1,2,3,4) would fit more than one of those types, then your call would be ambiguous and wouldn't compile. In that case, you would have to *qualify* the aggregate, thus: Print_Int_Array(Int_Array'(1,2,3,4)); Note the ' with the ( ). Sometimes, for clarity, it's a good idea to qualify the aggregate anyway, so the reader will know what type (1,2,3,4) is. Without realizing it, you've been using "array literals for functions and the like" whenever you've written a quoted string in a subprogram call! For example, Put_Line("Hello"); is an abbreviation for Put_Line(('H','e','l','l','o'));. - John Herro Software Innovations Technology http://members.aol.com/AdaTutor ftp://members.aol.com/AdaTutor A: "PS/2 Microchannel, GPIB, and Greyhound." Q: "Name two dogs and a bus."