[fpc-pascal] freeing string equal to setting to empty string?

Marc Santhoff M.Santhoff at t-online.de
Wed Jul 23 07:32:47 CEST 2008


Hi,

I understand right that (as I have asked before) an empty (ansi)string
is equal to NIL.

If this is correct, is setting a string to '' the same as setting the
string to NIL?

So i can e.g. use exchagably:

{$H+}
var
  s: string;
begin
  s := 'something';
  
  { this ... }
  s := '';
  { ... works equally to that: }
  s := NIL;

And more: is the memory consumed by the string freed using one of the
two methods?

TIA,
Marc





More information about the fpc-pascal mailing list