> Relational tests between pointers is only allowed by > the ISO C standard if the two pointers point into the > same array, or if a pointer points to exactly one byte > beyond the array.
There actually is a way to compare arbitrary data pointers within the C standards: you send the pointers through a printf- type function using "%p" and strcmp the results. That'll give you some kind of ordering, though not necessarily the obvious one. (No, I am not serously suggesting that anyone in their right mind you actually do so. Why does this keyboard have a smiley key?) Note, btw., that such use of %p also rules out using a garbage collector for C and C++. It simply cannot work if some of your pointers have been sent off by email to the other end of the world. At the very least you would have to consider any pointer that made it through %p to be live forever. Morten