comp.lang.ada
 help / color / mirror / Atom feed
* Array Syntax
@ 2008-02-29 15:19 ma740988
  2008-02-29 16:01 ` Ludovic Brenta
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ma740988 @ 2008-02-29 15:19 UTC (permalink / 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.







^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-03-04 16:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-29 15:19 Array Syntax ma740988
2008-02-29 16:01 ` 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

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