comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: Question on arrays
Date: Mon, 16 Sep 2002 18:48:21 GMT
Date: 2002-09-16T18:48:21+00:00	[thread overview]
Message-ID: <3D862764.9010100@acm.org> (raw)
In-Reply-To: d40d7104.0209160302.3a15485e@posting.google.com

prashna wrote:
> A_Integer(2) := (others => 2.0);
> 
> where A_Integer is an array of integer, whose index is integer ranging
> form 1..10.
> 
> I am using Tartan compiler on Aix machine and the error is
> "segmentation fault (core dumped)"

That's not a very useful error message.

If I read your description of A_Integer correctly, it is declared 
something like

A_Integer : array (1 .. 10) of Integer;

or the equivalent with a named array type.

In that case, "A_Integer (2)" is an Integer, while "(others => 2.0)" is 
an aggregate. To simplify, an aggregate can be considered a literal of a 
composite type. Since the left-hand side is a non-composite type 
(Integer) and the right-hand side is a value of some composite type (an 
aggregate), they do not match and the assignment is illegal.

I won't go into the difference between "2.0" and "2". If you don't 
understand that yet, then you need to work through some basic tutorials 
or texts on Ada before trying what you're working on.

-- 
Jeff Carter
"Oh Lord, bless this thy hand grenade, that with it thou
mayst blow thine enemies to tiny bits, in thy mercy."
Monty Python and the Holy Grail




  parent reply	other threads:[~2002-09-16 18:48 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
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 [this message]
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