<div dir="ltr">On Mon, Aug 26, 2013 at 9:27 AM, Gabriel Dos Reis <span dir="ltr">&lt;<a href="mailto:gdr@axiomatics.org" target="_blank" class="cremed">gdr@axiomatics.org</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Nevin Liber &lt;<a href="mailto:nevin@eviloverlord.com" class="cremed">nevin@eviloverlord.com</a>&gt; writes:<br>

<br>
| On 26 August 2013 11:00, Jeffrey Yasskin &lt;<a href="mailto:jyasskin@google.com" class="cremed">jyasskin@google.com</a>&gt; wrote:<br>
|<br>
|<br>
|     Could someone explain why we need to allow operator&lt;(T*) to be a non-order?<br>
|<br>
|<br>
| It comes from C.  I believe it comes from the days of segmented architectures.<br>
<br>
</div>You&#39;re right.  Historically, it came from segmented architectures.<br>
<br>
However, because it has been in the standard for that long, some<br>
implementations may have taken advantage of that semantics restriction<br>
even if they are not targeting segmented architecture.</blockquote><div><br></div><div>Also, there are now uses of segmented addressing outside of segmented architectures.</div><div><br></div><div>The interesting thing is that it remains possible (and unsurprisingly possible) to implement a total ordering for all addresses. It just means that this ordering may be marginally more complex than a single integer comparison on some architectures. I think this is a fine requirement to place on them. In all cases where the segment is known to be the same (the overwhelming majority), any reasonable implementation will produce the same code as today.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">   So, it is not<br>
the case that because we don&#39;t have wide spread architecture anymore<br>
means that removing that restriction is a breeze.  It will invalidate<br>
implementations that use compilation and program transformations based<br>
on that.<br></blockquote><div><br></div><div>I actually do not believe there is any such optimization or implementation today. I&#39;m not aware of even theoretical optimizations that really benefit from this.</div><div>
<br></div><div>The freedom that optimizing compilers very deeply need is that the ordering be totally unspecified. Preserving the relative order of two object&#39;s addresses is a very high bar (much higher than *providing* some relative order) and would impede many real world optimizations.</div>
<div><br></div><div>So long as we keep this, I have no knowledge of significant negative impacts on optimizing compilers. If you have other specific optimizations, please bring them up (clearly, I&#39;m not familiar with all optimizing compilers! ;])</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
If you make operator&lt; a total order for all valid pointers (and<br>
including the usual one-past-the-end pointers), I suspect you might also<br>
as a by-product impose a stronger requirement on operator== on pointers.<br></blockquote><div><br></div><div>This is actually my only real concern, and could well be addressed by a careful and thorough paper on the subject.</div>
</div></div></div>