[fpc-pascal] Is it save to think default value of untouched string is ''?

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Mar 7 00:17:03 CET 2010

On Sun, 7 Mar 2010 01:13:05 +0200
Juha Manninen <juha.manninen at phnet.fi> wrote:

> > Sorry ... What ? It must be garanteed in ansistring mode! or
> > everything will simple kboom! There is no way to initialize a non
> > initialized string.
> By initializing I mean:
>   str:='';
> or some other assignment.
> I remember having garbage in strings in Delphi when I assumed they are empty.
> Or was it only with function's string return value, I am not sure.
> Anyway, after that I was careful to always assign my strings.
> Maybe it is not true with FPC.

SetLength does not initialize the string characters.
ShortStrings are not always initialized.


More information about the fpc-pascal mailing list