From: "Eric G. Miller" <egm2@jps-nospam.net>
Subject: Re: "&" for array versus "&" for Strings
Date: Mon, 14 Oct 2002 16:34:50 GMT
Date: 2002-10-14T16:34:50+00:00 [thread overview]
Message-ID: <pan.2002.10.14.16.38.51.890659@jps-nospam.net> (raw)
In-Reply-To: slrnaq5ehk.5c6.randhol+news@kiuk0152.chembio.ntnu.no
In <slrnaq5ehk.5c6.randhol+news@kiuk0152.chembio.ntnu.no>, 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)).
next prev parent reply other threads:[~2002-10-14 16:34 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-08 10:57 "&" for array versus "&" for Strings Preben Randhol
2002-10-14 16:34 ` Eric G. Miller [this message]
2002-10-14 17:54 ` Robert A Duff
-- strict thread matches above, loose matches on Subject: below --
2002-10-08 11:53 Grein, Christoph
2002-10-08 13:46 ` Preben Randhol
2002-10-08 13:49 ` Preben Randhol
2002-10-08 16:41 ` Robert A Duff
2002-10-09 9:35 ` Preben Randhol
[not found] <200210081153.NAA17399@bulgaria.otn.eurocopter.de>
2002-10-08 12:21 ` David C. Hoos, Sr.
2002-10-08 13:56 ` Sergey Koshcheyev
2002-10-08 15:46 ` David C. Hoos
2002-10-08 15:56 ` Preben Randhol
2002-10-09 5:28 Grein, Christoph
2002-10-09 12:43 ` Robert A Duff
2002-10-09 17:38 ` Steven Deller
2002-10-09 19:46 ` Robert A Duff
2002-10-09 9:59 Grein, Christoph
2002-10-10 4:35 Grein, Christoph
2002-10-10 6:06 ` Preben Randhol
2002-10-10 6:28 Grein, Christoph
2002-10-10 7:15 ` Preben Randhol
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox