On 29 Oct 2014, at 15:09, hinsta...@yandex.ru wrote:

With lists it's worse. If you store pointers to interface variables, they become invalid the moment you don't have any "managed" variables left in scope.

Same is true for refcounted objects: if you store them in good old TObjectList, it will hold invalid pointers.

However this all is just something to keep in mind. I don't see the need of overcomplicating it on compiler level


It's not "just something to keep in mind", because if you include automatic conversion from ref-counted to non-refcounted classes, this is guaranteed to lead to very hard to debug problems. One of Pascal's foundations is that it has strong type checking and does not allow you to assign anything to anything just because it happens to have the same size in bits and somewhat similar functionality. You cannot assign an interface to a class instance without explicitly using "as" either.


Jonas

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to