comp.lang.ada
 help / color / mirror / Atom feed
From: jsa@alexandria (Jon S Anthony)
Subject: Re: Array Literals?
Date: 1996/08/13
Date: 1996-08-13T00:00:00+00:00	[thread overview]
Message-ID: <JSA.96Aug13150903@alexandria> (raw)
In-Reply-To: 4uo9b6$qj1@Masala.CC.UH.EDU


In article <4uo9b6$qj1@Masala.CC.UH.EDU> cosc19z5@Bayou.UH.EDU (Spasmo) writes:

> type Int_Array is array(Integer range <>) of Integer;
> 
> procedure Print_Int_Array ( I_List : Int_Array ) is
> begin
> 	for I in I_List'Range loop
> 		Put_Line( Integer'Image ( I_List(I) ) );
> 	end loop;
> end Print_Int_Array;
> 
> 
> Now when we call it, is it standardly acceptable to
> call it as such:
> 
> 	Print_Int_Array ( (1, 2, 3, 4) );
> 
> Where (1, 2, 3, 4) is an array literal? 

Yes.  That is simply an array aggregate and the type comes from the
context which sez it is an Int_Array.  No different than

    a : Int_Array := (1, 2, 3, 4);


> I know it
> works in GNAT3.05 but I want to make sure this isn't
> a fluke and that I can depend on this behavior
> regardless of which implementation I use.
  ^^^^^^^^^^

Well, the implementation could always be broken! :-)
But, you should be OK.


> So this would mean that array literals are in fact
> flexible enough to be used anywhere an array can
> be used eh?

If the shoe fits!


/Jon
-- 
Jon Anthony
Organon Motives, Inc.
1 Williston Road, Suite 4
Belmont, MA 02178

617.484.3383
jsa@organon.com





  reply	other threads:[~1996-08-13  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-12  0:00 Array Literals? Spasmo
1996-08-13  0:00 ` Jon S Anthony [this message]
1996-08-13  0:00 ` John Herro
1996-08-13  0:00   ` Spasmo
1996-08-14  0:00     ` John Herro
1996-08-14  0:00   ` Robert I. Eachus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox