[fpc-pascal]Two simple dynamic arrays questions

Alan Mead cubrewer at yahoo.com
Wed Jul 28 21:49:37 CEST 2004


Yes, this is a good idea.  I think it thwarts length() and low() but
since I'm using two dimensional arrays, these aren't helpful...

I'm not a fluent OOP programmer, but I'm already using a record to
record the real rows and columns, matrix name, etc. so I think I'm
going to wrap these open arrays in an object so that I can supply
replacements for these and other methods and it would be easy to hide
this wrinkle inside the object.

-Alan

--- "Cox, Stuart TRAN:EX" <Stuart.Cox at gems1.gov.bc.ca> wrote:
> Would not allocating the dynamic arrays a single element greater in
> size not
> permit you to address their elements the way you'd like. 
> I.e.: for a five element array, allocate size 6 and get [0..5] and
> then use
> only [1..5]?  Just pretend that the [0] position doesn't exist.
> Of Course, you'd have to be careful with low(x) as the index
> starting spot.
> If this is too easy what am I missing?
> 
> Stu
> 
> -----Original Message-----
> From: fpc-pascal-admin at lists.freepascal.org
> [mailto:fpc-pascal-admin at lists.freepascal.org] On Behalf Of Jonas
> Maebe
> Sent: Wednesday, July 28, 2004 12:00 PM
> To: fpc-pascal at lists.freepascal.org
> Subject: Re: [fpc-pascal]Two simple dynamic arrays questions
> 
> 
> 
> On 28 jul 2004, at 19:48, Alan Mead wrote:
> 
> > (1) Previously, I had fillchar'd the static arrays with zeros
> because 
> > they are sparse-ish.  Looks like dynamic arrays are automagically
> 
> > filled with zeros.  Is this true/permanent?
> 
> Yes.
> 
> > (2) There is no way, I supposed, to switch the array indexes to
> start 
> > at 1 is there?
> 
> No, there is unfortunately no way to do this.
> 
> 
> Jonas
> 
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 





More information about the fpc-pascal mailing list