Re: array

From: Rudy Velthuis (TeamB) (rvelthuis_at_gmx.de)
Date: 10/13/03


Date: 13 Oct 2003 09:54:26 -0700

ads wrote:

> Hello,
>
> I have TScanline32 = array[0..0] of TRGBQUAD;
>
> what is the range here? I know something like array[0..9] but not
> [0..0]

It is an array of one TRGBQUAD. Such definitions are usually used for
(pointers to) variable size arrays. I prefer to declare something a lot
bigger, and then use a *pointer* to that:

  PMyScanLine = ^TMyScanLine;
  TMyScanLine = array[0..65535] of TRGBQuad;

-- 
Rudy Velthuis (TeamB)
"C makes it easy to shoot yourself in the foot; C++ makes it harder, but
when you do, it blows away your whole leg."
    - Bjarne Stroustrup


Relevant Pages

  • Re: memory leak help!
    ... I don't have any pointers in my program ... at all...you have to declare them as type POINTER, ... the function similarity is called from within a loop of the main ... array to be sorted ...
    (comp.lang.fortran)
  • Re: Differance between Array and Pointers
    ... Well, except that arrays tend to be much larger than pointers, and the ... An array is a contiguous region of memory containing N elements of M ... indexing vs. a loop). ...
    (comp.arch.embedded)
  • [RFCv2][PATCH] flexible array implementation
    ... I call it a flexible array. ... storage for pointers to the second level. ... all locking must be provided by the caller. ... make sure to pass in &ptr instead of ptr. ...
    (Linux-Kernel)
  • Re: [RFCv2][PATCH] flexible array implementation
    ... I call it a flexible array. ... storage for pointers to the second level. ... all locking must be provided by the caller. ... make sure to pass in &ptr instead of ptr. ...
    (Linux-Kernel)
  • [RFC][PATCH] flexible array implementation v4
    ... I call it a flexible array. ... so never does an order>0 allocation. ... storage for pointers to the second level. ... all locking must be provided by the caller. ...
    (Linux-Kernel)