There is some special handling involved in that the code inside the try part (I think) is effectively a nested procedure.  It's important in the context of stack unwinding when an exception occurs.  There is a performance penalty when using them, which one reason why the compiler sources don't use them.  There's probably other reasons too.  There might be some speed-up potential where standard Exit calls are concerned, but I'm not sure.

Gareth aka. Kit

On 06/05/2021 23:17, Ryan Joseph via fpc-devel wrote:

On May 6, 2021, at 4:05 PM, Sven Barth via fpc-devel 
<fpc-devel@lists.freepascal.org> wrote:

Other than that, you're right and what Ryan is trying to do is definitely the 
intended purpose of try ... finally.

Is there any runtime code involved with try..finally or does it just reorganize 
the code to run at the end of the block? My understanding of the defer keyword 
is that is was just a fancy way to move some code into a block which always 
gets run with a function exits.

Regards,
        Ryan Joseph

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to