mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-12 10:49:31 +02:00
* runtime check
This commit is contained in:
parent
af98b48c22
commit
3e86b4d56e
@ -1,13 +1,33 @@
|
||||
{ %version=1.1 }
|
||||
{$mode objfpc}
|
||||
procedure p(a : array of const);
|
||||
{$ifdef fpc}{$mode objfpc}{$endif}
|
||||
|
||||
procedure p(a : array of const);
|
||||
var
|
||||
i : integer;
|
||||
begin
|
||||
for i:=low(a) to high(a) do
|
||||
begin
|
||||
write(i,': ');
|
||||
if (a[i].vtype=vtpchar) then
|
||||
begin
|
||||
writeln('"',a[i].vpchar,'"');
|
||||
if (a[i].vpchar<>'test') then
|
||||
begin
|
||||
writeln('Wrong string content');
|
||||
halt(1);
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
writeln('No string type (',a[i].vtype,')');
|
||||
halt(1);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
a : array[0..25] of char;
|
||||
|
||||
begin
|
||||
p([a]);
|
||||
a:='test';
|
||||
p([a,a]);
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user