comp.lang.ada
 help / color / mirror / Atom feed
From: ma740988@gmail.com
Subject: Array Syntax
Date: Fri, 29 Feb 2008 07:19:06 -0800 (PST)
Date: 2008-02-29T07:19:06-08:00	[thread overview]
Message-ID: <f62dad2b-1e64-4289-bd05-3ce7db98ffee@k2g2000hse.googlegroups.com> (raw)

Trying to garner a feel for Ada - while perusing texts - and I'm
having slight difficulties understanding array syntax.


   Max_Num : constant := 6;

   type Pixel_Data is
      record
         Num_Of_Values        : Int32;
         Is_Valid_Data           : Boolean;
      end record;

   type Pixel_Number is Int16 range 1 .. Max_Num ;
   type Pixel_Data_Array is array
     ( Pixel_Number range 1 .. Max_Num  )
     of Pixel_Data;

Pixel_Data_Array is an array 6 deep of composite type Pixel Data.  So
far so good?


Now given:

   Frames_In_Buffer : constant := 35 ;
   Buffer_Pixel_Data :
     array ( Int32 range 1 .. Frames_In_Buffer )
     of aliased Pixel_Data_Array ;

From the looks of this Buffer_Pixel_data is an array within an array.
On paper I'm having a hard time representing this in part becuase I'm
having a hard time understanding how a multi-dimensional array can
have two separate types.   IOW:  I'm envisioning in C/C++ land:

   int Buffer_Pixel_Data [ 35 ] [ 6 ]

Trouble is the 35 elements is of type Int32 and the 6 elements is of
type Pixel Data.  Then again, I'm sure I'm not deducing this right.

Any help appreciated in clearing up my confusion.  Thanks in advance.







             reply	other threads:[~2008-02-29 15:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-29 15:19 ma740988 [this message]
2008-02-29 16:01 ` Array Syntax Ludovic Brenta
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