From: Gautier Write-only <gautier@fakeaddress.nil>
Subject: Re: array and pointers
Date: Sat, 22 Nov 2003 11:16:47 +0100
Date: 2003-11-22T11:16:47+01:00 [thread overview]
Message-ID: <3FBF378F.FA7E5549@fakeaddress.nil> (raw)
In-Reply-To: 4948f537.0311220139.570c8a4e@posting.google.com
shoko:
# what is wwrong in the following code?:
#
# type Arr is Array(Item range<>) of Integer;
# a:Arr:=(1,2,2,2,3,4,3) ;
# type n_array_Ptr is access Arr;
# n: n_array_Ptr;
#
# begin
# n:= new Array_filter(a);
#
# put_line("hello");
A good idea is to read what the compiler says.
Here a test with GNAT:
arrrrrrr.adb:9:14: "Array_filter" is undefined
Okay, surely you meant "Arr" instead of "Array_filter".
n:= new Arr(a);
Let's try again:
arrrrrrr.adb:9:17: if qualified expression was meant, use apostrophe
arrrrrrr.adb:9:18: expect subtype mark for index constraint
If you want to copy a into the new n.all you have to use apostrophe
n:= new Arr'(a);
HTH
________________________________________________________
Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm
NB: For a direct answer, e-mail address on the Web site!
next prev parent reply other threads:[~2003-11-22 10:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-22 9:39 array and pointers shoko
2003-11-22 10:16 ` Gautier Write-only [this message]
2003-11-22 15:16 ` Steve
2003-11-22 17:45 ` Jeffrey Carter
2003-11-23 2:09 ` Hyman Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox