Hallo,

why is a pointer to a char not a pchar (for type helpers)?


program Project1;
{$Mode objfpc}{$H+} {$ModeSwitch typehelpers}
type TPcharHelper = type helper for pchar
  function toString(length: integer): string;
end;

function TPcharHelper.toString(length: integer): string;
begin
  SetString(result, self, length);
end;

var c: char;
begin
  c := 'x';
  writeln((@c).toString(1)); //does not compile
  writeln(pchar(@c).toString(1));
end.

Bye,

Benito

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to