[fpc-pascal] memory layout of arrays

2006-09-14 Thread Marc Santhoff
Hi, when using arrays in C the layout of arrays is sort of flat, since pointer arithmetics for accessing values works (e.g. pointer += 4 for 32 bit values). Is this the same for pascal/fpc? Do values of for example an integer array sit in memory at 4 Byte boundaries? I need to hand over arrays

Re: [fpc-pascal] memory layout of arrays

2006-09-14 Thread Jonas Maebe
On 14 Sep 2006, at 11:00, Marc Santhoff wrote: I need to hand over arrays to a C library and have no influence on how access is done internally (still und investigation). Currently the C lib reads garbage from my array ... That means that the type you use in Pascal is probably different

Re: [fpc-pascal] memory layout of arrays

2006-09-14 Thread Michael Van Canneyt
On Thu, 14 Sep 2006, Marc Santhoff wrote: Hi, when using arrays in C the layout of arrays is sort of flat, since pointer arithmetics for accessing values works (e.g. pointer += 4 for 32 bit values). Is this the same for pascal/fpc? Do values of for example an integer array sit in memory at

Re: [fpc-pascal] memory layout of arrays

2006-09-14 Thread Jerry
On Sep 14, 2006, at 2:00 AM, Marc Santhoff wrote: Hi, when using arrays in C the layout of arrays is sort of flat, since pointer arithmetics for accessing values works (e.g. pointer += 4 for 32 bit values). Is this the same for pascal/fpc? Do values of for example an integer array sit in

Re: [fpc-pascal] memory layout of arrays

2006-09-14 Thread Vinzent Hoefler
On Thursday 14 September 2006 09:20, Jerry wrote: however. Beware of 2D arrays in C because there seems to be no requirement in C that all of the data be allocated in contiguous memory; Most probably yes. This applies to all mutidimensional arrays in C. The reason is simple, arrays and

Re: [fpc-pascal] memory layout of arrays

2006-09-14 Thread Marc Santhoff
Am Donnerstag, den 14.09.2006, 11:16 +0200 schrieb Jonas Maebe: On 14 Sep 2006, at 11:00, Marc Santhoff wrote: I need to hand over arrays to a C library and have no influence on how access is done internally (still und investigation). Currently the C lib reads garbage from my array