Would you pay for GC?
pjmlp at progtools.org
Tue Jan 25 10:56:50 UTC 2022
On Tuesday, 25 January 2022 at 09:58:14 UTC, Ola Fosheim Grøstad
> On Tuesday, 25 January 2022 at 09:42:25 UTC, Araq wrote:
>> Only if you take the "deferred" RC route, which
>> Swift/Rust/C++/Nim do not!
> What do you mean by "deferred"? RC increment when taking a
> reference from the heap, but not when the reference is taken
> from the stack + periodic stack scanning?
> Actually, in C++ (and to some extent in Objective-C) you
> minimize reference counting by using programmer knowledge. You
> increment when you take it from the heap and from thereon you
> use a borrowed (raw) pointer down the call tree.
Pity that programmer knowledge can't do much to ABI requirements.
Also that trick only works in single developer code bases, good
luck not introducing a memory corruption some months/years down
My experience with COM proves that is generally what happens when
one decides to be smart about manually optimizing AddRef/Release
More information about the Digitalmars-d