Michael Van Canneyt wrote:
On Thu, 14 May 2015, Mark Morgan Lloyd wrote:
Starting off with this fragment
begin // Start of procedure/function
try
...
if something then
exit;
...
finally
...
end
end;
My understanding is that exit "magically" transfers control into the
finally block before exiting the procedure. However to state the
obvious, in this fragment
begin // Start of procedure/function
try
...
if something then
exit;
...
except
...
end
end;
control doesn't go via the except block.
That is as designed. There is no exception, so no need to go in the
exception.
Yes, obviously. However I'm interested in the cases where (1) a
try-finally is embedded in a try-except and (2) try-except is embedded
in try-finally, and the order that exit and any potential equivalents
disentangles things.
Is there a single place in the documentation where this sort of
behaviour is described and prioritised, taking into account interfaces
etc.?
http://www.freepascal.org/docs-html/ref/refse103.html#x214-22400017.3
What does 'taking into account interfaces' have to do with exceptions ?
They are unrelated.
Except that- as I understand it- when the reference count is decremented
to oblivion, it will be destroyed by "magic" code in the context of the
block it was created in. Same obviously applies to strings, dynamic
arrays and so on. Are there any other cases where this sort of thing
happens?
I've got a horrible feeling that I'm not expressing my question well.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal