[fpc-pascal] more questions on storage

Michael Van Canneyt michael at freepascal.org
Wed Sep 26 09:30:54 CEST 2007



On Wed, 26 Sep 2007, Marc Santhoff wrote:

> Hi,
> 
> having this definition:
> 
> 
> {$mode objfpc}
> {$longstrings on}
> type
> 	cmpstr = record
> 		ID: integer;
> 		Name: string;
> 		Value: single;
> 	end;
> 
> var
> 	buf: array [0..MAX] of cmpstr;
> 
> How does the memory layout of the buffer look like?
> 
> I tried to get there with ddd but I couln't find out how the string
> inbetween is put into memory. For atomic types (integer, single) it's
> pretty clear, but longstrings do have a variable size. How is the buffer
> set up?

Longstrings are not working correctly. You should use ansistrings or
shortstrings.

Michael.



More information about the fpc-pascal mailing list