<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>While pure and inline do have a lot of overlap and, internally,
probably share some features for convenience (like a copy of the
node tree), they are not the same - for example, recursive
functions can be pure, but not inline, and functions that
dereference pointers can be inlined, but not made pure. The
constant initialisation is one reason for pure functions, as it
might be more convenient to declare things like "const ONE_OVER_E
= Exp(-1);" instead of "const ONE_OVER_E =
0.36787944117144232159552377016146;" (although Exp might be an
intrinsic rather than a function - not sure).</p>
<p>Note that while there's room for auto-inlining certain routines,
I would not recommend "auto-puring" because determining if a
function actually is pure or not is likely going to be an
expensive operation, and it's more likely that a function will not
be pure.<br>
</p>
<p>Gareth aka. Kit<br>
</p>
<div class="moz-cite-prefix">On 25/06/2019 16:31, Ben Grasset wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAL4d7FhXsQ_+vf-XU3jKZxY=v9P=QUHRKscBhc7C4A-s_xc6Yg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">On Tue, Jun 25, 2019 at 1:20 AM Sven Barth via
fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org"
moz-do-not-send="true">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">
Correct. Though considering that we're talking about
*compile time* the <br>
compiler *could* treat consts (in {$J-} mode) as constants
if pure <br>
functions are involved...<br>
</blockquote>
<div><br>
</div>
<div>I'd be fine with the {$J-} requirement (I tend to use
{$J-} most of the time anyways, actually.)</div>
<div><br>
</div>
<div>Again, I'm aware all of this will take a while to
implement, and will be an incremental process. Overall
though I think proper compile-time constant initialization
needs to be something `pure` eventually enables, as if it
doesn't then it just becomes "slightly-different-inlining".
(And like denisgolovan pointed out in another message,
inlining should remain a separate concept that can be mixed
with pure, or not mixed with it, depending on the use case.
E.G. a C++ compiler will automatically inline basically
anything at -O3, but it will not let you use a non-constexpr
function to initialize an actual constexpr value.)</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
</blockquote>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br />
<table style="border-top: 1px solid #D3D4DE;">
<tr>
<td style="width: 55px; padding-top: 13px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
<td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>
</td>
</tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>