Thread View: alt.comp.borland-delphi
4 messages
4 total messages
Started by Hugo Mind
Mon, 18 Aug 2003 17:44
Division by Zero
Author: Hugo Mind
Date: Mon, 18 Aug 2003 17:44
Date: Mon, 18 Aug 2003 17:44
19 lines
1567 bytes
1567 bytes
why is this exception never called ?
procedure TForm1.Button1Click(Sender: TObject);
var
x : real;
begin
try
x := (2 /0);
except
on e: exception do showmessage('eRRoR');
end;
end;
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.510 / Virus Database: 307 - Release Date: 14/08/2003
Re: Division by Zero
Author: KLinZ
Date: Mon, 18 Aug 2003 17:59
Date: Mon, 18 Aug 2003 17:59
22 lines
2095 bytes
2095 bytes
Hugo Mind wrote:
> why is this exception never called ?
>
> try
> x := (2 /0);
> except
> on e: exception do showmessage('eRRoR');
> end;
Probably because the line which contains x := (2 /0);' has been deleted by
the optimizer. Hence the warning "Value assigned to 'x' never used". Try
compiling with optimization turned off and see what happens.
Or is the above code an excerpt from more complex code?
BTW: it doesn't compile at all on my archaic Delphi version (D3). It gives
an error: 'Overflow in conversion or arithmetic operation'. What Delphi
version are you using?
--
www.zenobits.com
Re: Division by Zero
Author: Hugo Mind
Date: Mon, 18 Aug 2003 18:24
Date: Mon, 18 Aug 2003 18:24
7 lines
1463 bytes
1463 bytes
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.510 / Virus Database: 307 - Release Date: 14/08/2003
Re: Division by Zero
Author: Hugo Mind
Date: Mon, 18 Aug 2003 18:26
Date: Mon, 18 Aug 2003 18:26
41 lines
2407 bytes
2407 bytes
Delphi 7 ent.
this is all code, i found this problem in my application and to sure i
create an new project just to see how the division is handled.
I even re-install delphi.
cheers
"KLinZ" <klinz@NOSPAMMERTSzenobits.com> wrote in message
news:bhr473$87v$1@hermes.castel.nl...
> Hugo Mind wrote:
>
> > why is this exception never called ?
> >
> > try
> > x := (2 /0);
> > except
> > on e: exception do showmessage('eRRoR');
> > end;
>
> Probably because the line which contains x := (2 /0);' has been deleted by
> the optimizer. Hence the warning "Value assigned to 'x' never used". Try
> compiling with optimization turned off and see what happens.
>
> Or is the above code an excerpt from more complex code?
>
> BTW: it doesn't compile at all on my archaic Delphi version (D3). It gives
> an error: 'Overflow in conversion or arithmetic operation'. What Delphi
> version are you using?
>
> --
> www.zenobits.com
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.510 / Virus Database: 307 - Release Date: 14/08/2003
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads