On Tue Jan 5 11:49:06 PST 2016, charles.fors...@gmail.com wrote: > On 5 January 2016 at 19:01, Devon H. O'Dell <devon.od...@gmail.com> wrote: > > > so given any of the examples in this thread, if you typedef'ed > > ptrdiff_t to long, then the compiler technically isn't actually doing > > anything wrong. whether it is doing something useful is a different > > question. > > > > Well, although I knew that was true, I didn't want to push the point because > in practice, people have a right to expect certain reasonable behaviour, > and it's quite reasonable to expect that p+(q-p) yields q if they both point > into the same array that the system agreed to allocate somehow. > It make sense to use 64 bits for the difference, and indeed the code > block that adds the current cast has an if(1 && ...) suggesting an if(0 &&
yes! this. one thing i love about the plan 9 compilers is that my reasonable expectations are not violated by some happy optimizer, or decision. this gets us back to the op's pov > i get that probably nobody cares about c standards here, but it might > be useful to mention what c99 and c11 say about this issue, since the which i think is wrong. there is some current silliness with compilers that conflates allowed with required and undefined with can be deleted. i see plan 9's decisions as rejecting this way of thinking. however, this is in no way anti-standard. - erik