[fpc-pascal] Why this code fails

Alexander Todorov alexx.todorov at gmail.com
Tue Jan 16 14:04:13 CET 2007


Hello,
This code compiles with 2.0.4 but gives runtime error 231 .
program project1;

{$mode objfpc}{$H+}

uses Variants;

var V : Variant;
    S : String = 'test ';
begin
   V := 42;
   writeln(V);

   S := S + V; // fails here
   writeln(S);
end.


the output is:
alex at optical:~/temp/copy$ ./project1
42
Runtime error 231 at $08052EBB
  $08052EBB
  $08066DB3
  $08063166
  $08063374
  $080616D0
  $0806217D
  $08054917
  $080481AD  main,  line 13 of project1.lpr
  $0804809F



More information about the fpc-pascal mailing list