Sign in Join

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

Mailing lists / fpc-pascal / 2003-05

exceptions

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Adam Naumowicz

Hi,

Where can I find detailed information about all the predefined Exception classes and their semantics?
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).

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:
Sosnowa 64, 15-887 Bialystok, Poland http://math.uwb.edu.pl/~adamn/ ======================================================================

Jonas Maebe
to Adam Naumowicz
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...

Jonas

Adam Naumowicz
to Jonas Maebe

Jonas,

Thanks for your response.

Jonas Maebe wrote 14 lines
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:
Sosnowa 64, 15-887 Bialystok, Poland http://math.uwb.edu.pl/~adamn/ ======================================================================