<div dir="auto"><div><div class="gmail_quote"><div dir="ltr">Am So., 27. Jan. 2019, 14:12 hat Walter Prins <<a href="mailto:wprins@gmail.com">wprins@gmail.com</a>> geschrieben:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">On Sun, 27 Jan 2019 at 01:53, John Doe <<a href="mailto:slightlyoutofphase@gmail.com" target="_blank" rel="noreferrer">slightlyoutofphase@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">On Sat, Jan 26, 2019 at 7:44 PM Sven Barth via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org" target="_blank" rel="noreferrer">fpc-devel@lists.freepascal.org</a>> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="auto">Changing this behavior would not only be a backwards incompatibility, but would also violate the ABI which describes how records shall be passed.</div></div></blockquote><div><br></div><div>On second thought, I definitely agree with you that changing the basic behavior of the compiler in that regard sounds like an idea that is not remotely possible due to how it would very likely break large amounts of existing code. That was a dumb suggestion on my part.</div></div></div></div></blockquote><div><br></div><div>Just thinking out loud (probably a bad idea) but: </div><div><br></div><div>Would it perhaps be possible to treat this as a type of optimization however?  Which is to say, if the called routine makes no changes to the passed record, then it should not matter whether compiler implicitly const passes the parameter or copies it?  (If the routine *does* change the passed record then it does the normal thing.)  Of course I have no idea whether the dataflow analysis I imagine needed to support this is whatsoever plausible to be done without unacceptable compromises  (And even then, I'd guess it's not something there'd be sufficient appetite for even if in theory it might be possible...?)</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">We currently have no function specific adjustments of the calling convention, so this would be rather involved to implement (I know that e.g. the Visual Studio compiler does that).</div><div dir="auto">Also keep in mind that a unit does not know how it is used. With Lazarus a package is compiled once for multiple projects where one could be a self contained application and the other a library that has such a function in its export section (constructed example, I know, but those things need to be kept in mind). </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>