[fpc-devel] Re: dominant short strings in compiler source

Daniël Mantione daniel.mantione at freepascal.org
Fri May 19 19:18:45 CEST 2006



Op Fri, 19 May 2006, schreef Flávio Etrusco:

> Forgive me if I'm saying BS but it's been about 10 years since I
> programmed in TurboPascal (and used ShortStrings), but don't
> ShortStrings use the size they are declared with? And 255 is just
> default size (if no size is specified)?

Of course. But unless there is a good reason to limit the size, most 
people use string without maximum length specification. And with a 
Pstring, only the amount of memory that is needed to fit the string is 
allocated, which is what we are talking about here. An assembler label 
like ".L1" is stored as a Pstring internally, and requires 4 bytes plus 
heap internal data structures.

Daniël


More information about the fpc-devel mailing list