On 28/05/2026 15:31, Wayne Sherman wrote:
On Thu, May 28, 2026 at 1:05 AM Martin Frb wrote:
I was trying to find some definitive answers on how smart pointers
(will) work.
E.g. do smart pointers have a compiler controlled build in ref-counter
like other managed types (strings/dyn-array).
It seems not, but info I found is a bit conflicting.
https://wiki.freepascal.org/management_operators
"AddRef is called after the contents of a record have been duplicated
by a bitwise copy (for example after, not during, an assignment.)
By itself it does not do any lifetime management, but you can use it
to implement it."

Thanks, so that is "managed operators" (and they allow (but don't force) refcounting, if the user adds there own refcount) => but no compiler magic refcount.

But then

https://fpc-devel.freepascal.narkive.com/KlDxttCU/pascal-smart-pointers-idea-arc-implementation
The second step is some concept of low level structures for smart pointers
(in this conception we have two kinds of smart pointers - smart pointers
for objects and smart pointers for pointers):

Has anything evolved of that? Is there are concept of smart pointers that goes beyond just wrapping another managed record around some data?

Or are there any plans?


The purpose is to establish a list of data-types that either has "hidden refcount", or will possible get that ...

_______________________________________________
fpc-devel maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to