int a[20], b[20], *p = a, i; if ((uintptr_t)(a + 20) == (uintptr_t)b) { b[5] = 1; for (i = 0; i < 40; i++) *p++ = 0; printf("%d\n", b[5]); }
-
-
@RichFelker Ok. C11, 6.3.2.3p1, says that (int *)(void *)p is equal to p (given "int *p;"). Can it be used instead of p? -
@ch3root@RichFelker Address equality is orthogonal to the memory rules. Can't access an object via a pointer derived from another. -
@ch3root@RichFelker A pointer in C isn't simply an address. It's also undefined to do accesses via an integer-derived pointer. -
@CopperheadSec@ch3root Not if the value of that integer is equal to the value obtained by casting a valid pointer to uintptr_t.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.