> Anyone interested in C and UB will want to read most of John Regehr's > http://blog.regehr.org/ - it hosts some of the best material on UB.
Unfortunately Mr. (I'm assuing this is appropriate given "John") Regehr is falling into the same trap he's trying to warn against: basically, assuming that the mental model he has is the only one that could ever possibly be relevant. For example, consider the "Comparisons of Pointers to Unrelated Objects" example: # define SQLITE_WITHIN(P,S,E) \ ((uintptr_t)(P)>=(uintptr_t)(S) && \ (uintptr_t)(P)<(uintptr_t)(E)) He writes that "[c]omparisons between unrelated objects destroy determinism because the allocator makes no guarantees about their relative locations". No. Comparisons between unrelated objects destroy determinism because pointers into different objects may not be comparable! He's assuming the "the entire address space is a single array of bytes (perhaps with holes)" memory model is the only possible one. He needs to talk with someone who wrote large-model 8086 code - or someone who's used the Lisp Machine C compiler I heard of that represents pointers as <array,index> pairs. /~\ The ASCII Mouse \ / Ribbon Campaign X Against HTML mo...@rodents-montreal.org / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B