<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 8 April 2013 14:32, David Nadlinger <span dir="ltr"><<a href="mailto:see@klickverbot.at" target="_blank">see@klickverbot.at</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Monday, 8 April 2013 at 12:37:48 UTC, Manu wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On 8 April 2013 21:46, Iain Buclaw <<a href="mailto:ibuclaw@ubuntu.com" target="_blank">ibuclaw@ubuntu.com</a>> wrote:<br>
</div><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Only builtins are pure in the sense of 'C'.  Even functions considered<br>
PUREstrong by the frontend may update an internal state, so the rules just<br>
don't apply.  Except for maybe global functions...   In any case, the only<br>
benefit you can reap from 'D pure' functions are that they are more likely<br>
to be const-folded / inlined.<br>
<br>
</blockquote>
<br></div><div class="im">
Oh my god... ..... this is the most upsetting thing I've heard all day! :(<br>
No really, I have been SOOOO excited for so long about this optimisation<br>
potential in D!<br>
There's gotta be something that can be done! >_<<br>
<br>
Does the front end know if the function actually DOES assign to any state?<br>
The compiler could easily work that out, and in the event it doesn't<br>
actually perform any such assignment, it could be marked pure for reals...<br>
</div></blockquote>
<br>
Iain, are you sure about that? (No offense, but you have been wrong about what GCC can/can't do in the past. :P) Could you maybe elaborate a bit and present a counterexample? It might also be a question of how the »as-if« rule is really defined for pure function calls.<br>

<br>
In any case, if the source is available, the LLVM optimizer is usually very good at figuring out »pure for reals« (inferring the LLVM 'readnone' attribute). Obviously, this doesn't help you when you are doing separate compilation, though.<span class="HOEnZb"><font color="#888888"><br>

<br>
David<br>
</font></span></blockquote></div><br></div><div class="gmail_extra">Sure about what?  I don't even know what you are talking about. :o)<br><br></div><div class="gmail_extra"><sic><br clear="all"></div><div class="gmail_extra">
<br><br>-- <br>Iain Buclaw<br><br>*(p < e ? p++ : p) = (c & 0x0f) + '0';
</div></div>