Re: array

From: Perry Way (no.delphipro.spam_at_no.spam.earthlink.net)
Date: 10/13/03


Date: Mon, 13 Oct 2003 13:33:16 -0700


> > 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;

THANK YOU RUDY!

I'm not sure if I should be tagging my name to this post because after
reading another post you've referenced similarly, on this same thread, I am
here doing the slap against my forehead kind of thing saying "I coulda had a
V8"... and I'm supposed to know this stuff.. right? ;)

I had been looking for this very simple cure to a situation wherein I had no
way to know the exact number of bytes that I was reading for each segment of
a datastream until a "switch" occurs in the stream that I am reading in
real-time and only once.. (this about a month ago) when having developed a
major 30 minutes of turrets syndrome due to memory failure (mine) I decided
to get subjective and use a PChar instead so I could "dynamically" position
myself in the stream... but now I see how I could still work with the native
types... Ahhhh I coulda had a V8 and used a heck of a lot less pointer
repositioning...

Anyway back to this dynamic element of these two types of "hacks"
referenced.. I think this one is objectively better. I agree.

PW



Relevant Pages

  • need help with list of lists ( multi dimensional array)
    ... Hi - looking for pointers or links to resources ... ... I am reading in a text file - lines are ... It seems to be that an array would work great here, ...
    (comp.lang.perl.misc)
  • Re: [C] functions and 2D arrays?
    ... >to arrays of arrays of int, when you could be passing pointers ... >to arrays of int. ... to array" is rather out of the ordinary. ... feels more "natural" after you've been reading and writing C and C++ ...
    (alt.comp.lang.learn.c-cpp)
  • Re: confused with sizeof and pointers
    ... > I am new to C Programming and just started reading K&R. ... > finish the pointers chapter but got very confused with: ... But haven't we dereferenced arr ... arr is an address to the base of the array ...
    (comp.lang.c)
  • 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)
  • Re: Really Stuck, Please Help
    ... I am not sure how to construct an array. ... Reading Master Log", of the "Copreco Master Log" workbook. ... Dim sourceBook As String ...
    (microsoft.public.excel.programming)