Dennis Leas writes: [>Greg Lutz writes:] >> Remember, what Robert is trying to do is write a library, i.e., >> the code in which he wants to validate a pointer does not have >> control of what the caller is actually passing in a function >> argument that is supposed to be a pointer. >> . . . > >Yes, it's an admirable idea but it just won't work for any arbitrary >pointer. > >If he wants to validate pointers, then require the pointers to come from his >own library package, a la Aaron's suggestion - allocate your own control >structure in which to wrap a normal pointer.
Or stated another way, add calls to your library which allocate and free's pointers (and records that allocation); and then do not recognize any pointers which are allocated outside your library. Any calling program which uses your library will also have to use only the allocating mechanism that comes with that library. This will produce false negatives safely. It will break however if you have multiple libraries which all need pointer validation. IMHO. YMMV. Ron Nicholson HotPaw Productions <http://www.hotpaw.com/rhn/hotpaw> -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
