[fpc-pascal]exceptions

Adam Naumowicz adamn at math.uwb.edu.pl
Fri May 30 13:39:14 CEST 2003


Jonas,

Thanks for your response.

On Fri, 30 May 2003, Jonas Maebe wrote:

>
> On vrijdag, mei 30, 2003, at 12:47 Europe/Brussels, Adam Naumowicz
> wrote:
>
> > I found it a bit surprising that byte-variable overflow does not raise
> > EIntException...
> > I'm using FPC 1.0.6 (with -Co on the command line).
>
> Also use -Cr. An overflow and a range check are semantically exactly
> the same (you get a value which cannot be represented by a certain
> number of bits). However, Borland first introduced range checking that
> didn't catch overflows, so when they added overflow check, they made it
> a different switch for compatibility's sake. This means that FPC is
> also stuck with two switches for catching essentially the same error...

OK, so I understand that EIntOverflow is raised *only* when longint
variables capacity is exceeded, and in the case of booleans
ERangeError must be checked instead. Is that so?

Another question that I want to ask is why the following primitive sample
seems to work as expected but does not produce any output on Solaris
(using 1.0.6).
------------------------
uses sysutils;
var i,k : Integer;
x:real;

begin
i:=0;
try
x:=k/i;
except
on Edivbyzero do writeln('div');
on Exception do writeln('other');
end;
end.
------------------------

BTW, is there any chance that some Solaris binary distro newer than 1.0.6
can be obtained?
I tried to compile it myself but failed as it seems that
my compiler (and its RTL) are not sufficient to build the new one.

Best regards,
Adam Naumowicz

======================================================================
Department of Applied Logic            fax. +48 (85) 745-7662
Institute of Computer Science          tel. +48 (85) 745-7559 (office)
University of Bialystok                e-mail: adamn at mizar.org
Sosnowa 64, 15-887 Bialystok, Poland   http://math.uwb.edu.pl/~adamn/
======================================================================







More information about the fpc-pascal mailing list