<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body smarttemplateinserted="true">
<div id="smartTemplate4-template">Hallo,<br>
</div>
<div><br>
</div>
<div>why is a pointer to a char not a pchar (for type helpers)?</div>
<div><br>
</div>
<div><br>
program Project1;<br>
{$Mode objfpc}{$H+} {$ModeSwitch typehelpers}<br>
type TPcharHelper = type helper for pchar<br>
function toString(length: integer): string;<br>
end;<br>
<br>
function TPcharHelper.toString(length: integer): string;<br>
begin<br>
SetString(result, self, length);<br>
end;<br>
<br>
var c: char;<br>
begin<br>
c := 'x';<br>
writeln((@c).toString(1)); //does not compile<br>
writeln(pchar(@c).toString(1));<br>
end.</div>
<div><br>
</div>
<div>Bye,<br>
<p>Benito </p>
</div>
<p><br>
</p>
</body>
</html>