> Geoffrey Keating wrote: >> Mirco Lorenzon wrote: >> >> .., are comparisons in the following program legal code? > > No. > >> ... >> void *a, *b; >> ... >> if (a < b) > > Because 'a' and 'b' are not part of the same array, > the behaviour is undefined.
Although I don't mean to contest the conclusion, I do find it curious that as all pointer values referencing unique objects must be correspondingly unique, it would follow that they will be correspondingly ordered with respect to each other. Therefore although technically undefined, it seems quite reasonable to expect an implementation to support ordered inequality comparisons between arbitrary pointers to equivalent effective types? As it would seem otherwise impossible for an implementation to support the ability to write code which enables the relative comparison of generalized memory pointers unless one were to explicitly declare a union of an array of all potentially allocateable memory, and all explicitly and implicitly declared objects; which doesn't seem reasonable?