[fpc-pascal] Const params question

Sven Barth pascaldragon at googlemail.com
Wed Oct 11 17:11:04 CEST 2017


Am 11.10.2017 15:28 schrieb "Ryan Joseph" <ryan at thealchemistguild.com>:
>
>
>
> > On Oct 11, 2017, at 5:01 PM, Michael Van Canneyt <michael at freepascal.org>
wrote:
> >
> > No, you need constref then.
>
> Ok, so constref/var are the same in terms of copying. The docs say const
reduces stack size? I never label my parameters with const but maybe it’s
worth it some cases.
>

This is basically only the case for managed parameters like strings and
interfaces as such don't need an implicit try...finally-block in case of
const and constref to correctly reset their reference count in case of an
exception

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20171011/37ed7d1f/attachment.html>


More information about the fpc-pascal mailing list