<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-01-27 15:03 GMT+01:00 Sven Barth <span dir="ltr"><<a href="mailto:pascaldragon@googlemail.com" target="_blank">pascaldragon@googlemail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><p>Thank you for the link, because now I know what was *really* bugging me about the code all the time (you know that feeling that you instinctively know that something is wrong, but you can't really <a href="http://pinpoint.it" target="_blank">pinpoint.it</a>? ;) ). </p></span></blockquote><div>I have those feeling half of my life as programmer >.<<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><p>The point is that it is not necessarily guaranteed on each and every platform that the parameter passing of a (interface) method is the same as for a global function with an additional instance parameter. This *might* be true for those platforms on which Windows runs and thus we need to correctly support COM interfaces, but on other platforms this *could* be completely different (e.g. a platform could pass the instance in a register instead of the stack while normal functions get all their parameters from the stack; this would totally mess up the parameters that the functions expects).<br></p></span></blockquote><div>We need to somehow clarify many things in this field. My next big milestone is RTTI.Invoke method (I'd like to omit implementing this :P). For example only in FPC dyn. array parameter is passed on stack instead of by reference (in opposition to Delphi)... with small change in r30870 for register calling convention (changed for properties). Ofc. is possible to use constref modifier but... Arghhhh...</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><p></p></span><p>
And *this* is something I don't want to deal with as this could potentially break every time we improve or fix something in the parameter passing code and then only for specific platforms...</p>
<p>So if you would instead change the code to use real class instances that implement the interfaces (they can be lazily allocated singletons or so) then I'd definitely be inclined to include the code in trunk.</p></blockquote><div>To implement this addition would be nice to fix this bug: <a href="http://bugs.freepascal.org/view.php?id=29245">http://bugs.freepascal.org/view.php?id=29245</a></div><div>Currently any class var (precisely "managed var" kind, like dyn array or interface) allocated in class constructor is released before class destructor.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<p>And before you say that Delphi does it differently: the Delphi developers only have to maintain the code for 3 platforms (i386, x86_64 and ARM), we however have more to maintain and thus the chances for breakage are higher.</p></blockquote><div>Life of FPC developer is so painful and happy at the same time...</div></div>-- <br><div><div dir="ltr"><div>Best regards,<br>Maciej Izak</div></div></div>
</div></div>