I
infobahn
Richard said:Apart from the dubious nature of this trick in general,
I disagree that it's either dubious or a trick.
> how does it help
the OP at all, who specifically asked about
It gives the best help I can think of that remains topical.
That is, how do you distinguish between a pointer to a simple,
non-allocated object, which is neither null nor invalid, and a random
integer cast to a pointer, which isn't null, but very likely _is_
invalid?
The only way I can think of that /might/ work would involve a huge
overhead; it involves building and maintaining a runtime "database"
of object representations that are known to be valid. This would
have such a horrendous runtime cost that I can't see anyone actually
choosing to do this.
There may, of course, be a platform-specific trick of which the
OP can take advantage, and personally I think that's what he is
after. Of course, such tricks are off-topic here.