{ GPC demo program. For copying conditions see the file `COPYING.DEMO'. }

program SetLengthDemo;

var
  S: String (26);

begin
  S := 'Hello, world!';
  SetLength (S, Length ('Hello'));
  WriteLn (S);                                           { 'Hello' }

  SetLength (S, 26);
  WriteLn (S);                     { 'Hello, world!(%$xy"!#&~+(/]' }
                            { undefined characters ^^^^^^^^^^^^^^  }

  SetLength (S, 42);       { The overflow is *not* (yet) detected. }
  WriteLn (S);        { This might cause a runtime error or crash. }
end.
