In a related remark, Clang treats it as UB if you pass more than PTRDIFF_MAX to malloc, and can silently miscompile your program if it does.
I mean better than writing a compiler that produces output 100-1000x slower that's useless except as a way to express disagreement w/C.
-
-
I disagree with your premise, but it's too long for twitter.
-
And as I said at the start, typecasting them to longs works just fine. http://www.unix.org/whitepapers/64bit.html …
-
It doesn't. If (32-bit) p=0x7fffffff, q=0x80000000 (same array), q-p is perfectly well-defined but (long)q-(long)p is not.
-
In linux that address range is allocated to the kernel, longs wrap around when you don't break the compiler, and unsigned long exists.
-
(1) No, varies by arch; 32-bit x86 kernel has 0xc0000000+ reserved. Some archs are 0x80000000+ resv'd. 32-bit on x86_64 kernel = no resv'd.
-
(2) It's not broken but whatever, (3) unsigned long works if you want to assume address model. This precludes all advanced, safe C impls.
-
I.e. ensuring your code will not work in a much-better, much-safer future, and actively opposing said future by increasing cost to switch.
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.