I've been looking at some old code which still seems to work in fpc 3.0.0 - but is it safe? The code looks like:

{$mode delphi}

var Buf: PChar;
      s: string;
begin
Buf := LoadString; {returns a pointer to an arbitrarily long null terminated string}

  s := string(Buf); {seems to work - but should it?}
end;

The above has been around since Delphi days and has never caused trouble, but I am certainly wondering if this coercion is safe anymore given the introduction of AnsiString code pages.

Any ideas?
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to