<div dir="ltr">On 17 October 2013 23:13, Gabriel Dos Reis <span dir="ltr">&lt;<a href="mailto:gdr@axiomatics.org" target="_blank">gdr@axiomatics.org</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">|     I suppose the other implication that is on the mind of many people but<br>

</div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">
|     not being discussed is<br>
|<br>
|        p != q =&gt; intptr_t(p) != intptr_t(q)<br>
|<br>
|<br>
| I&#39;m not concerned about that, as p -&gt; intptr_t(p) -&gt; p has to result in a<br>
| matching pointer. I don&#39;t see how that is workable if the implication above<br>
| fails.<br>
<br>
</div>Hmm, remember I am very slow.  Please explain this for me in further<br>
details; I -think- I guess what you are saying but I would rather<br>
make sure you spell out for me how this is working on today&#39;s machines<br>
for which we need to make operator&lt; a total ordering, and how they match<br>
(or differ from existing implementations.)<br></blockquote><div><br></div><div>Proof by contradiction:</div><div><br></div><div>1. Suppose p != q =&gt; intptr_t(p) == intptr_t(q)</div><div><br></div><div>The guarantee for a pointer p of type T* is, if intptr_t is provided:</div>

<div><br></div><div>p equals (T*)(intptr_t)(p);</div><div><br></div><div>let x = intptr_t(p)</div><div><br></div><div>x must also equal (intptr_t)(q) because (intptr_t)(p) == (intptr_t)(q)</div><div><br></div><div>It is impossible for (T*)(x) != (T*)(x).</div>

<div><br></div><div>With substitution, (T*)(intptr_t)(p) != (T*)(intptr_t)(q) is also impossible.</div><div><br></div><div>Therefore,<br></div><div><br></div><div><span style="color:rgb(80,0,80)">p != q =&gt; intptr_t(p) != intptr_t(q)</span><br>

</div><div><br></div><div>must be true.</div><div><br></div><div>Q.E.D.</div></div>-- <br> Nevin &quot;:-)&quot; Liber  &lt;mailto:<a href="mailto:nevin@eviloverlord.com" target="_blank">nevin@eviloverlord.com</a>&gt;  (847) 691-1404
</div></div>