comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: Array Syntax
Date: Fri, 29 Feb 2008 08:01:27 -0800 (PST)
Date: 2008-02-29T08:01:27-08:00	[thread overview]
Message-ID: <a4084f1f-9fbc-4341-b71c-dda167e06f85@h11g2000prf.googlegroups.com> (raw)
In-Reply-To: f62dad2b-1e64-4289-bd05-3ce7db98ffee@k2g2000hse.googlegroups.com

No, what you have is an array of 35 arrays of 6 records. Each record
(of type Pixel_Data) has two components, Num_Of_Values and
Is_Valid_Data.

So:

 Buffer_Pixel_Data (12) (1).Is_Valid_Data := True;

is legal.

The index types for the outermost array and the 35 arrays within it
are different. This is good as it makes it more difficult to
inadvertently use the wrong index. For example:

for J in Buffer_Pixel_Data'Range loop
   for K in Buffer_Pixel_Range (J)'Range loop
       Buffer_Pixel_Data (K) (J) := -- ERROR
          (Num_Of_Values => 42, Is_Valid_Data => True);
   end loop;
end loop;

will give you a compile-time error because you inadvertently swapped J
and K. HTH

--
Ludovic Brenta.



  reply	other threads:[~2008-02-29 16:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-29 15:19 Array Syntax ma740988
2008-02-29 16:01 ` Ludovic Brenta [this message]
2008-02-29 17:16 ` Georg Bauhaus
2008-02-29 17:48 ` Dmitry A. Kazakov
2008-02-29 17:50 ` Jeffrey R. Carter
2008-03-04 16:18 ` ma740988
replies disabled

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