[fpc-pascal] Question about System.Move()

Sven Barth pascaldragon at googlemail.com
Mon Jan 11 18:51:00 CET 2021


Benito van der Zander via fpc-pascal <fpc-pascal at lists.freepascal.org>
schrieb am Mo., 11. Jan. 2021, 15:26:

> Hi,
>
> perhaps a  safe, generic function for this copying could be added to the
> RTL. Like:
>
> Procedure ManagedMove<T>(const source: T;var dest: T;count: SizeInt);
>

In principle a good idea. However this is one of those cases where you'd
definitely need to use constref instead of const.

And when you use IsManagedType, it does not distinguish standard strings
> with such weird managed types.
>

You can additionally use GetTypeKind as well. Unlike TypeInfo it directly
returns the TTypeKind (which for this case is enough) and is considered
constant.

And perhaps there could be a special attribute to mark which kind of moving
> is needed, e.g..
>   type [moveable] TA = record
>   type [referencecounted] TA = record
>   type [nonmoveable] TA = record
>

No, thank you.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210111/3554f5d9/attachment.htm>


More information about the fpc-pascal mailing list