comp.lang.ada
 help / color / mirror / Atom feed
From: Preben Randhol <randhol+abuse@pvv.org>
Subject: Re: Array problem
Date: Fri, 24 May 2002 22:31:25 +0000 (UTC)
Date: 2002-05-24T22:31:25+00:00	[thread overview]
Message-ID: <slrnaetfpu.333.randhol+abuse@kiuk0156.chembio.ntnu.no> (raw)
In-Reply-To: FSyH8.39826$n4.8867800@newsc.telia.net

On Fri, 24 May 2002 22:09:41 GMT, Andreas Lans wrote:
> Thanks for all your help so far, I got the program working at least, but now
> a runtime error has started to come up, and the thing its complaining about
> is this:
> 
> if(pairs <= 100) then
> 
> Clients(Pairs) := new Male;
> 
> Servers(Pairs) := new Female;
> 
> Pairs := Pairs+1;
> 
> 
> 
> Where Pairs is an integer, I thought I could use this to store Females and
> Males in the array but when I try this, it says: Illegal operand for array
> conversion, any thoughts on this??


if you look in the spec file (.ads) you see that the array is defined
from 1 .. 100 and your Pairs start with 0. This means you are trying to
access outside the bounds of the array. Either change the pairs
initiation to 1 or do:


Pairs := Pairs+1;
if(pairs <= 100) then
 Males (Pairs) := new Male;
 Females (Pairs) := new Female;
end if;

Now the program won't crash, but it won't do much either.

Preben



  reply	other threads:[~2002-05-24 22:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-24 22:09 Array problem Andreas Lans
2002-05-24 22:31 ` Preben Randhol [this message]
2002-05-25  8:49   ` Andreas Lans
2002-05-25 12:12     ` Preben Randhol
2002-05-25 16:30     ` Robert Dewar
2002-05-25 18:00       ` Andreas Lans
2002-05-26  9:09         ` Preben Randhol
2002-05-25 16:38     ` Robert Dewar
2002-05-25 11:30   ` Robert Dewar
2002-05-27 10:39 ` Alfred Hilscher
replies disabled

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