On 3/2/2013 08:25, Xiangrong Fang wrote:
I guess there is really a bug, see the following:
==============================
f := 123;
try
f := ln(0);
except
end;
//WriteLn(f);
//{
if f = 123 then
WriteLn('f=123, not modified')
else
WriteLn('f is modified to:', f);
//}
===============================
If I just WriteLn(f), it output Nan, I think there is some magic happening here.
If I try to use if-then on f, then I get:
An unhandled exception occurred at $000000000040028C :
EDivByZero : Division by zero
$000000000040028C line 18 of project1.lpr
i am unable to reproduce this...
Lazarus 1.1 r39940 FPC 2.6.0 i386-win32-win32/win64
i started a new Simple Program project and pasted your above code into it...
C:\Documents and Settings\nil>LOCALS~1\Temp\project1
f=123, not modified
program Project1;
var
f : extended;
begin
f := 123;
try
f := ln(0);
except
end;
//WriteLn(f);
//{
if f = 123 then
WriteLn('f=123, not modified')
else
WriteLn('f is modified to:', f);
//}
end.
so i started a new Program project and again...
C:\Documents and Settings\nil>LOCALS~1\Temp\project1
f=123, not modified
program Project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes
{ you can add units after this };
var
f : extended;
begin
f := 123;
try
f := ln(0);
except
end;
//WriteLn(f);
//{
if f = 123 then
WriteLn('f=123, not modified')
else
WriteLn('f is modified to:', f);
//}
end.
what am i missing??
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus