[fpc-devel] VAL behavior

2010-03-23 Thread Dariusz Mazur

Hi
  I found different behavior of VAL function under Delphi and FPC

var
  i,io : integer

begin
  val('9 ',ii,io);
  writeln(ii);
  writeln(io);
end;


Delphi set ii to 9, FPC set 0 (io is equal 2)
is this bug?

--
  Darek




___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] VAL behavior

2010-03-23 Thread Dariusz Mazur

W dniu 2010-03-23 20:04, dmitry boyarintsev pisze:

On Tue, Mar 23, 2010 at 6:50 PM, Dariusz Mazurdar...@emadar.com  wrote:
   

Delphi set ii to 9, FPC set 0 (io is equal 2)
is this bug?
 

Don't assume the value of ii (since it's invalid), if io  0

   


I don't ask about it. Only if this difference is a bug.

--
  Darek




___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] VAL behavior

2010-03-23 Thread Florian Klaempfl
Dariusz Mazur schrieb:
 W dniu 2010-03-23 20:04, dmitry boyarintsev pisze:
 On Tue, Mar 23, 2010 at 6:50 PM, Dariusz Mazurdar...@emadar.com  wrote:
   
 Delphi set ii to 9, FPC set 0 (io is equal 2)
 is this bug?
  
 Don't assume the value of ii (since it's invalid), if io  0


 
 I don't ask about it. Only if this difference is a bug.
 

No. IMO not.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] VAL behavior

2010-03-23 Thread Tomas Hajny
On Tue, March 23, 2010 21:13, Dariusz Mazur wrote:
 W dniu 2010-03-23 20:04, dmitry boyarintsev pisze:
 On Tue, Mar 23, 2010 at 6:50 PM, Dariusz Mazurdar...@emadar.com
 wrote:

 Delphi set ii to 9, FPC set 0 (io is equal 2)
 is this bug?

 Don't assume the value of ii (since it's invalid), if io  0



 I don't ask about it. Only if this difference is a bug.

FWIW, TP gives the same results as FPC. Nevertheless, as already pointed
out by others, you should not rely on returned values in case of an error.

Tomas


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel