[fpc-devel] smart pointers

Martin Frb lazarus at mfriebe.de
Thu May 28 10:04:54 CEST 2026


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/smartpointers
- no build in refcount? (at least disassembler did not show any)

https://forum.lazarus.freepascal.org/index.php?topic=42028.0
- there is an "AddRef" but no info if there is a "DecRef"

https://fpc-devel.freepascal.narkive.com/KlDxttCU/pascal-smart-pointers-idea-arc-implementation
- there is a "copy" but neither "AddRef" nor "DecRef"



Also the last page speaks of a difference of "record operators" (which 
is what all the other pages seem to do?)
and an actual pointer "smart pointer"?

Though the smart pointer seems itself to be a record, with a user 
defined (not compiler added) refcount field?




More information about the fpc-devel mailing list