<div dir="ltr"><div class="gmail_extra">On 18 October 2013 01:46, Christopher Jefferson <span dir="ltr"><<a href="mailto:chris@bubblescope.net" target="_blank">chris@bubblescope.net</a>></span> wrote:<br><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Here is a suggestion. How about we make the result of comparing pointers from different allocations into implementation-defined behaviour?</p>
</blockquote><div>While it gets it out of this group, I don't think that addresses the real problem.</div><div><br></div><div>Of course, if you think that:</div><div><br></div><div><span class="Apple-style-span" style="border-collapse:collapse;color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">bool isInArray = <span class="il" style="background-image:initial;background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">std</span>::<span class="il" style="background-image:initial;background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">begin</span>(a) <= p && p < <span class="il" style="background-image:initial;background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">std</span>::<span class="il" style="background-image:initial;background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">end</span>(a);</span><br>
</div><div><span class="Apple-style-span" style="border-collapse:collapse;color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span class="Apple-style-span" style="border-collapse:collapse;color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><span class="Apple-style-span" style="color:rgb(34,34,34);font-family:arial;font-size:small;border-collapse:separate"><div>
is an unreasonable piece of code, there are no problems. :-) If you think it is reasonable, I don't see how making it implementation-defined behavior stops the optimizer from rewriting that as:</div><div><br></div><div>
bool isInArray = static_cast<bool>(p);</div><div><br></div><div>(possibly even 'isInArray = true;', but I'd have to study the rules for nullptrs to see if this is allowed)</div><div><br></div><div>And developers can't count on implementation-defined behavior in portable code. Look at all the pain people go through because C didn't nail down (for valid reasons at the time) the signness of char. And the implementation-defined behavior of the representation of char only has two possible outcomes...</div>
</span></span></div></div>-- <br> Nevin ":-)" Liber <mailto:<a href="mailto:nevin@eviloverlord.com" target="_blank">nevin@eviloverlord.com</a>> <a href="tel:%28847%29%20691-1404" value="+18476911404" target="_blank">(847) 691-1404</a>
</div></div>