[fpc-pascal] Finally, exceptions and so on.

Michael Van Canneyt michael at freepascal.org
Thu May 14 12:45:49 CEST 2015



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.

>
> 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.

Michael.



More information about the fpc-pascal mailing list