const again

BCS BCS at pathlink.com
Fri Dec 7 15:25:27 PST 2007


Walter Bright wrote:
> BCS wrote:
> 
>> totally random though: I'm designing a program and ran across a place 
>> where I want to say "this pointer shall never be dereferenced, it 
>> shall only be used as an identity" the idea being that I want to be 
>> sure that the code has no dependencies on anything under it. It would 
>> be used somthing like a key in a hash table but where the test is 
>> "same thing" not "equal things". What should this be implemented as? 
>> Does this have any place in the const system? Is there an existing 
>> clean solution?
> 
> 
> Since the point of a pointer is to dereference, perhaps a pointer is the 
> wrong thing. Perhaps it should be a struct.
> 

In my case I have a table of info that I want to get things from, the 
things to be got are associated with object that are available to the 
caller. If I don't use the object pointers, then I need to add some 
process unique ID to the objects as handles. The pointer is good enough 
except that I want to drop the implies functional dependency. I might 
try typedefs of void* but that seems hackish.



More information about the Digitalmars-d mailing list