Re: [fpc-pascal] Why this code fails

2007-01-17 Thread Jonas Maebe
On 17 jan 2007, at 12:28, Alexander Todorov wrote: On 16 jan 2007, at 15:55, Matt Emson wrote: >> The reason is that it tries to convert S to a number rather than V to >> a string. The error is still in the current 2.1.1. May be the compiler should generate compile time error or a warnin

Re: [fpc-pascal] Why this code fails

2007-01-17 Thread Alexander Todorov
On 16 jan 2007, at 15:55, Matt Emson wrote: >> The reason is that it tries to convert S to a number rather than V to >> a string. The error is still in the current 2.1.1. May be the compiler should generate compile time error or a warning. I am using VarToStr anyway just tried to look more lik

Re: [fpc-pascal] Why this code fails

2007-01-16 Thread Jonas Maebe
On 16 jan 2007, at 15:55, Matt Emson wrote: The reason is that it tries to convert S to a number rather than V to a string. The error is still in the current 2.1.1. Does FPC have : function VarToStr(const V: Variant): string; As this is what I would tend to advocate for this kind os assig

Re: [fpc-pascal] Why this code fails

2007-01-16 Thread Jonas Maebe
On 16 jan 2007, at 15:55, Matt Emson wrote: The reason is that it tries to convert S to a number rather than V to a string. The error is still in the current 2.1.1. Does FPC have : function VarToStr(const V: Variant): string; As this is what I would tend to advocate for this kind os assig

Re: [fpc-pascal] Why this code fails

2007-01-16 Thread Matt Emson
> The reason is that it tries to convert S to a number rather than V to > a string. The error is still in the current 2.1.1. Does FPC have : function VarToStr(const V: Variant): string; As this is what I would tend to advocate for this kind os assignment anyway. M ___

Re: [fpc-pascal] Why this code fails

2007-01-16 Thread Jonas Maebe
On 16 jan 2007, at 14:04, Alexander Todorov wrote: 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 r