Why do these two pointer subtractions give different results?
<p>Consider the following code:</p>

<pre><code>char* p = new char[2];
long* pi = (long*) p;
assert(p == pi);         // OK

char* p1 = &amp;p[1];
long* pi1 = (long*) p1;
assert(p1 == pi1);       // OK

int d = p1 - p;
int d1 = pi1 - pi;
assert(d == d1);         // No :(
</code></pre>

<p>After this runs, I get <code>d == 1</code> and <code>d1 == 0</code>, although <code>p1 == pi1</code> and <code>p == pi</code> (I checked this in the debugger). Is this undefined behavior?</p>
