[fpc-devel] Managed types and reference counts revisited

Adriaan van Os fpc at microbizz.nl
Wed Aug 17 12:09:17 CEST 2016


Either I am looking wrong (and missing the point) or the text at 
<http://www.freepascal.org/docs-html/ref/refse91.html> (a follow-up on 
<http://bugs.freepascal.org/view.php?id=26874>) is incorrect.

Doesn't the call to DoIt1(y,7) in procedure Test3 cause the reference count to be increased (from 0 
to 1) and then decreased (from 1 to 0 and thus disposed) ? And doesn't DoIt1 use value parameters ? 
Therefore, doesn't the comment on  the const case (on the top of the page) belong to the 
value-parameter (aka "nothing") case ? I would say, If const parameters, like var parameters, do 
nothing, there is no reference count decrease, therefore no dispose of classes (implementing an 
interface) even when the reference count is 0 ?

Regards,

Adriaan van Os



More information about the fpc-devel mailing list