From: "gshibona @ b e l l s o u t h . n e t" <gshibona@bellsouth.net>
Subject: array slices
Date: Mon, 12 May 2003 21:24:31 -0400
Date: 2003-05-12T21:24:31-04:00 [thread overview]
Message-ID: <3EC0494F.A7D67AA4@bellsouth.net> (raw)
I wonder if someone could point to the error in this code. I'm looking
to fill array a with a "row" slice
of array c. There doesn't appear to be much info on this particular
facet of Ada, yet what I have seen
suggests that the syntax below is correct.
procedure ada_2daryslice is
a : array(1..4) of integer;
c : array( 1..2, 1..4 ) of integer;
begin
c := (
1 => (0, 1, 2, 4 ),
2 => (8, 16, 32, 64)
);
-- this seems to yield the expected results
a(1..4) := ( 1,2,3,4);
-- however, this does not...
a(1..4) := c(1)(1..4);
end ada_2daryslice;
The compiler complains of too few subscripts in the array reference.
To wit...
gnatmake -g -gnatv ada2daryslice.adb
gnatgcc -c -g -gnatv ada2daryslice.adb
GNAT 3.13p (20000509) Copyright 1992-2000 Free Software Foundation,
Inc.
Compiling: ada2daryslice.adb (source file time stamp: 2003-05-13
01:20:09)
17. a(1..4) := c(1)(1..4);
|
>>> too few subscripts in array reference
17 lines: 1 error
gnatmake: "ada2daryslice.adb" compilation error
It's quite possible that I've been looking at this for much too long to
be objective. Thanks in advance
for any help.
Ger
next reply other threads:[~2003-05-13 1:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-13 1:24 gshibona @ b e l l s o u t h . n e t [this message]
2003-05-13 1:28 ` array slices Jeffrey Carter
2003-05-13 1:49 ` tmoran
2003-05-13 11:53 ` James S. Rogers
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox