<div dir="ltr">Ah, ok thanks for the explanations.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 21, 2013 at 2:54 PM, Sven Barth <span dir="ltr"><<a href="mailto:pascaldragon@googlemail.com" target="_blank">pascaldragon@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am <a href="tel:21.03.2013%2014" value="+12103201314" target="_blank">21.03.2013 14</a>:48, schrieb Kostas Michalopoulos:<div class="im">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks, i understand that. My question is, can i somehow make FPC to add AddRef/Release calls also to TBlah so i can use refcounting with a class just like i would use it with an interface?<br>
</blockquote>
<br></div>
No. At least not yet (when a new Delphi is released which might be featuring reference counted objects than this is up for discussion again)<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is there some technical limitation on why this is only done with interfaces and not all objects that descend from a refcounted interface?<br>
<br>
</blockquote>
<br></div>
It's more a logical problem. Assume you have a "TInterfacedObject" which you put into a variable "intf" of type "TInterfacedObject". As long as you use only "intf" there won't be any problem. But once you assign the value of "intf" to e.g. a variable "obj" of type "TObject" you'll have a problem, because the compiler does not know that "obj" contains a variable of type "TInterfacedObject" and thus the compiler can not create any reference counting calls. This way you would (depending on the situation) either create a memory leak or the interface would be freed before you stopped using the instance stored in "obj". So this situation is basically the same as we have today with the difference that we can now clearly say when reference counting will be applied and when not: if the variable is a (COM) interface then reference counting will be applied, otherwise it won't.<div class="HOEnZb">
<div class="h5"><br>
<br>
Regards,<br>
Sven<br>
<br>
--<br>
______________________________<u></u>_________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lists.lazarus.freepascal.org" target="_blank">Lazarus@lists.lazarus.<u></u>freepascal.org</a><br>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.<u></u>freepascal.org/mailman/<u></u>listinfo/lazarus</a><br>
</div></div></blockquote></div><br></div>