Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2010-03

VAL behavior

5 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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

Reply by email

Dariusz Mazur
to dmitry boyarintsev

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

Show quoted text 8 lines
On Tue, Mar 23, 2010 at 6:50 PM, Dariusz Mazur 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

Reply by email

Florian Klaempfl
to Dariusz Mazur
Show quoted text 12 lines
W dniu 2010-03-23 20:04, dmitry boyarintsev pisze: > On Tue, Mar 23, 2010 at 6:50 PM, Dariusz Mazur 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.

Reply by email

Tomas Hajny
to Dariusz Mazur: W dniu 2010-03-23 20:04, dmitry boyarintsev pisze: I don't ask about it. Only if this…
Dariusz Mazur wrote 12 lines
W dniu 2010-03-23 20:04, dmitry boyarintsev pisze: > On Tue, Mar 23, 2010 at 6:50 PM, Dariusz Mazur > 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

Reply by email