fpc/tests/webtbs/tw8148.pp
Jonas Maebe a3f059bc29 * call the ansistring version of val for zero-based array-of-char
parameters (because they can be auto-converted to ansistring, but not
    to shortstring) (mantis #8148)

git-svn-id: trunk@6076 -
2007-01-19 18:22:03 +00:00

26 lines
414 B
ObjectPascal

program ValVsArrayOfChar;
{$IFDEF FPC}
{$mode delphi}
{$ENDIF}
procedure test(a: ansistring);
begin
end;
var
Code : Integer;
D : Double;
s : Array[byte] of Char;
begin
s := '123';
test(s);
Val(s, D, Code); // compiles only in delphi
if (abs(d-123.0) > 0.00001) then
halt(1);
Val(PChar(@s), D, Code); // compiles in both delphi and FPC
if (abs(d-123.0) > 0.00001) then
halt(1);
end.