comp.lang.ada
 help / color / mirror / Atom feed
From: Preben Randhol <randhol+news@pvv.org>
Subject: Re: Question on arrays
Date: Mon, 16 Sep 2002 12:03:16 +0000 (UTC)
Date: 2002-09-16T12:03:16+00:00	[thread overview]
Message-ID: <slrnaobi46.5e7.randhol+news@kiuk0156.chembio.ntnu.no> (raw)
In-Reply-To: d40d7104.0209160302.3a15485e@posting.google.com

On 16 Sep 2002 04:02:44 -0700, prashna wrote:
> Hi all,
> Pls explain what is wrong in this statement?
> 
> A_Integer(2) := (others => 2.0);
                             ^^^
                             Isn't this a real and you have integers in
                             the array. Does Tartan allow you to compile
                             this?

Anyway the problem with the statment above is that you are trying to put
the composite type from (other => 2) into the array at the second
element. Here you can only put a integer.

I assume you have a simple array like:

type A_Integer_Type is array (1..10) of Integer;
A_Integer : A_Integer_Type;

So please explain a bit more what you are trying to do here and also
read:

   http://www.it.bton.ac.uk/staff/je/adacraft/ch06.htm
   and
   http://goanna.cs.rmit.edu.au/~dale/ada/aln/6_arrays.html

An example program:

procedure t is

      type A_Integer_Type is array (1..10) of integer;
      A_Integer : A_Integer_Type;

begin
   -- Now I want to put the interger 5 in the array place 2 and 1 in all
   -- the others.
    A_Integer := (2 => 5, others => 1);
end t;



Preben



  reply	other threads:[~2002-09-16 12:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-16 11:02 Question on arrays prashna
2002-09-16 12:03 ` Preben Randhol [this message]
2002-09-16 19:15   ` tmoran
2002-09-17  4:53     ` prashna
2002-09-16 12:08 ` Marin David Condic
2002-09-16 18:48 ` Jeffrey Carter
2002-09-17  9:14 ` David C. Hoos, Sr.
replies disabled

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