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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5037bf0bb33408c8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-14 09:35:36 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp2.aus1.giganews.com!nntp.giganews.com!newsfeed1.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail From: "Eric G. Miller" Subject: Re: "&" for array versus "&" for Strings User-Agent: Pan/0.13.0 (The whole remains beautiful (Debian GNU/Linux)) Message-ID: Newsgroups: comp.lang.ada References: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: Mon, 14 Oct 2002 16:34:50 GMT NNTP-Posting-Host: 216.119.6.188 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1034613290 216.119.6.188 (Mon, 14 Oct 2002 09:34:50 PDT) NNTP-Posting-Date: Mon, 14 Oct 2002 09:34:50 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:29773 Date: 2002-10-14T16:34:50+00:00 List-Id: In , Preben Randhol wrote: > According to the ARM 4.5.3: > > 3. The concatenation operators & are predefined for every nonlimited, > one-dimensional array type T with component type C. They have the > following specifications: > > 4. function "&"(Left : T; Right : T) return T > function "&"(Left : T; Right : C) return T > function "&"(Left : C; Right : T) return T > function "&"(Left : C; Right : C) return T > > If I use this in this way: > > ------------------------------------------------------------------ > with Ada.Text_IO; use Ada.Text_IO; > procedure Array_Test is > > type Name_Array is array (Positive range <>) of String (1..6); > > procedure Print_Names (Names : Name_Array) is > begin > for No in Names'First .. Names'Last loop > Put_Line (Integer'Image(No) & ": " & Names (No)); > end loop; > end; > > begin > > Print_Names ("Ada " & "Babbel"); ITYM, Print_Names (Name_Array'("Ada ", "Babbel")); OR declare First : Name_Array := Name_Array'("Ada ", "Babbel"); Second: String(1..6) := "Odin "; begin Print_Names(First & Second); end; AFAIK, "Ada " & "Babbel" is type String(1..12) not Name_Array(1..2). > end Array_Test; > ------------------------------------------------------------------ > > Then the result becomes: > > > 1: A 2: d 3: a 4: 5: 6: 7: B 8: a 9: b 10: b 11: e 12: l > Why is this happening. It should even compile (didn't w/ gcc-3.1 (gnat)).