Talk:Avoiding implicit try finally section

From Free Pascal wiki
Jump to navigationJump to search

Do you know in which cases an implicit try .. finally block is created?

It is created any time the compiler needs it. Basically if you use any type which needs compiler magic cleanup. ansitrings,variants,com style interaces,resourcestrings.

maybe the compier developers could add an option to generate a warning when an implicit try-finally is inserted. (This was added by Plugwash to "article" page, Michalis only moved it to "discussion" page)

I'm not FPC developer, but I don't think such warning would be useful. There are just too many cases when implicit try-finally section must be added, so such warning would be displayed very very often, making it quite useless. As Peter Vreman suggested on fpc-devel mailing list, one can always look at generated assembler code (compile with -al) to see when this happens. Michalis

As a sidenote: let's sign up contributions to "discussion" page (write three ~ characters to get your username automatically inserted). This helps readers to understand who is saying what, without constantly looking at "history" page. Michalis