comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@acm.nospam.org>
Subject: Re: Array Syntax
Date: Fri, 29 Feb 2008 17:50:55 GMT
Date: 2008-02-29T17:50:55+00:00	[thread overview]
Message-ID: <3CXxj.2617$TT4.412@attbi_s22> (raw)
In-Reply-To: <f62dad2b-1e64-4289-bd05-3ce7db98ffee@k2g2000hse.googlegroups.com>

ma740988@gmail.com wrote:
> 
>    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 ;

This is not valid. You either want a subtype, a derived type ("new Int16"), or 
just a type ("is range").

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

This can just be

type Pixel_Data_Array is array (Pixel_Number) of Pixel_Data;

Normally, unless you're doing something where you need to match the HW, you 
should avoid types such as those implied by Int16 and Int32. Array indices are 
not such a case, so you'd probably be better off with

type Pixel_Number is range 1 .. Max_Num;

and

type Frame_Number is range 1 .. Frames_In_Buffer;

-- 
Jeff Carter
"I like it when the support group complains that they have
insufficient data on mean time to repair bugs in Ada software."
Robert I. Eachus
91



  parent reply	other threads:[~2008-02-29 17:50 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
2008-02-29 17:16 ` Georg Bauhaus
2008-02-29 17:48 ` Dmitry A. Kazakov
2008-02-29 17:50 ` Jeffrey R. Carter [this message]
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