[fpc-pascal] C-blocks

Sven Barth pascaldragon at googlemail.com
Fri Nov 16 14:20:05 CET 2018


Am Fr., 16. Nov. 2018, 12:57 hat Ryan Joseph <ryan at thealchemistguild.com>
geschrieben:

>
>
> > On Nov 16, 2018, at 5:33 PM, Sven Barth via fpc-pascal <
> fpc-pascal at lists.freepascal.org> wrote:
> >
> > When a function contains at least one anonymous function then a capture
> object is created which is shared by all anonymous functions in the
> function and also all captured local variables are moved there. If there is
> no variable to capture the capture object is nevertheless created.
>
> But is it an object on the heap with reference counting?
>

Yes.


> I read a number of articles on Lambda support in c++ and they seem to
> think in *some* instances the compiler can inline the lambda and see no
> speed penalty but they depends on it not being passed outside of the
> declaring scope. c++ may get away with this because you need to manually
> request captured variables.
>

FPC could try that as well for such cases, but first and foremost it must
work correctly for the general, unoptimized case.

Regards,
Sven

> <http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20181116/963cc28f/attachment.html>


More information about the fpc-pascal mailing list