[fpc-pascal] Find the nature of a pointer

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Sep 1 20:04:49 CEST 2006

On 1 sep 2006, at 19:54, Felipe Monteiro de Carvalho wrote:

> I have a function that will receive a Handle. That handle could be a
> pointer to a structure, or a object. Is there any safe way to discover
> it's nature?

No, if only because there is no generic way to distinguish a random  
record which just looks like an object (because it happens to contain  
the right bytes at the right place) and a genuine object (or anything  
else for that matter).

The only way would be to make sure all objects are allocated from a  
separate memory pool, and checking whether the passed address lies in  
this pool.


More information about the fpc-pascal mailing list