Are there any problems with using pointers as hash keys during program execution? (no need to store on disk and use it later, as this causes obvious problems)
There are many circumstances when I need to quickly find out if an object belongs to a particular object manager. A quick way to check this is to store each object in the object manager in a hash table, where the object pointer is the key to the actual object: for example, HashTable
No, no problem. It is like saving int .
int
The pointer has a value that does not change and uniquely identifies the resource.
Of course, there are problems if you use your pointers poorly, but this is another, uncorrelated thing.
It should work well enough. Do you see any problems? Maybe you should just try and see. :)
On top of my head. If the memory space that your hash table points to is freed without first deleting references to the memory space that your pointers point to, memory leaks will occur.
Source: https://habr.com/ru/post/651162/More articles:Getting exception exception in finally block in iterator - c #How can you make a 2 dimensional array in C? - cWhat is a parameterized query? - phpcannot define constructor as protected or closed! What for? - phpIs there an implementation of VBScript Markdown? - htmlServing dynamic zip files through Apache - apacheHow to check if an alarm is set - androidUnit testing - algorithm or sample based? - language-agnosticCan I use the builder design pattern with sleep mode? - javaPrerequisites for the .NET Framework 3.5 SP1 Client Profile - installationAll Articles