[fpc-pascal] Passing nested procs out?
Sven Barth
pascaldragon at googlemail.com
Thu Nov 15 14:24:22 CET 2018
Am Do., 15. Nov. 2018, 12:40 hat Ryan Joseph <ryan at thealchemistguild.com>
geschrieben:
>
>
> > On Nov 15, 2018, at 5:14 PM, Sven Barth via fpc-pascal <
> fpc-pascal at lists.freepascal.org> wrote:
> >
> > See the notes mentioned here:
> http://wiki.freepascal.org/FPC_New_Features_2.6.0#Support_for_nested_procedure_variables
> >
> > Don't know if it is documented as such, but if not, it should be.
> >
>
> Sorry I’m not understanding this. I read we can make the assignment but
> the part I’m curious about is passing the function pointer out of the
> nested functions scope. I did some tests and it work in some cases and gave
> me garbled memory in others. Just wanted to make absolutely certain what’s
> happening here.
>
The linked entry answers your question directly:
"if you assign a nested routine to nested procedure variable and then exit
the nested routine's parent stack frame, calling the nested procedure
variable will result in undefined bahaviour [sic]."
Regards,
Sven
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20181115/f2500333/attachment.html>
More information about the fpc-pascal
mailing list