On 2013-06-27 11:45, Hans-Peter Diettrich wrote: > > Automatic reference counting works pretty well, doing it manually is > asking for trouble.
Sometimes it becomes trick (at least with reference counted interfaces). eg: I have code where I pass a interface around, but don't want the reference count to increment - so you need to take special precaution. Then I also have a container that holds references to interfaces, but again I don't want the container to increment reference counts - which would normally be the case. Sometimes the opposite is also true. Then there is also the question of when does the interface or object get freed - timing is sometimes important too. eg: I can't use some of the code I used to use in Delphi with interfaces, because the code "apparently" relies on undocumented Delphi language behaviour (even some commercial apps rely on that same behaviour). Free Pascal frees the Interface instances at different times to Delphi - so the code in my application under Free Pascal had to be changed. More info: Google mouse cursor management with Interfaces, or look at CodeSite's method tracing abilities. Reference counting is a double-edged sword. Regards, - Graeme - -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
