Re: Try Finally...
From: VBDis (vbdis_at_aol.com)
Date: 10/28/04
- Next message: VBDis: "Re: Try Finally..."
- Previous message: VBDis: "Re: Try Finally..."
- In reply to: Martin Harvey (Demon account): "Re: Try Finally..."
- Next in thread: L D Blake: "Re: Try Finally..."
- Reply:(deleted message) L D Blake: "Re: Try Finally..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Oct 2004 07:59:09 GMT
Im Artikel <i8dtn0lmc1pag4olh3dtjv71ovadk0op78@4ax.com>, "Martin Harvey (Demon
account)" <martin@nospam_pergolesi.demon.co.uk> schreibt:
>>The Retry idea was (is?) to re-run the code in the TRY section of a
try/except
>>block... If you fixed the problem, why not give it another shot?
>Yes, but this is typically to fix problems like page faults.
In BASIC a RESUME or RESUME NEXT was commonly used practice, in times before
SEH. It may have it's place even in SEH, perhaps as a replacement for many
small code sections of the pattern:
retries := MaxRetryCount;
while retries > 0 do begin
try SomethingCritical; goto succ;
except TryRepair; dec(retries);
end;
end;
{if retries <= 0 then} SignalUnrecoverableError;
succ: ...
or
try try TryThis except {don't worry} end finally WhatEverRequried end;
But I'm not sure whether Delphi reports the line (code address) and stack state
in the /current/ procedure, containing the code that caused an exception
somewhere down in the call stack. Resuming at the place where the exception
occured doesn't make much sense, since the parameters that caused the exception
(div/0, overflow...) can be modified only when the exception handler has direct
access to these variables. Resuming in the current procedure, i.e. in the try
block with the according exception handler, could make sense, but is feasable
only with appropriate support by the compiler and RTS. This is how the BASIC
exception handling works, sometimes pretty nice to implement, but sometimes
very hard to code with regards to checking for explicit line numbers (where the
error occured) and error conditions.
Laura, do you have a concrete idea how to implement a Retry feature in Delphi?
DoDi
- Next message: VBDis: "Re: Try Finally..."
- Previous message: VBDis: "Re: Try Finally..."
- In reply to: Martin Harvey (Demon account): "Re: Try Finally..."
- Next in thread: L D Blake: "Re: Try Finally..."
- Reply:(deleted message) L D Blake: "Re: Try Finally..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|