Reference related

closed account (9y8C5Di1)
Assume you had a struct:

struct a{
unsigned long long ref;

To get the memory address of a pointer.

Then assume you had a class for storing each memory address passed to it, + a fake label for differencing the addresses, and a count to count the amount of memory addresses.

Could you then have assigned to a void pointer the memory address and deallocate the memory related to it?
closed account (S6k9GNh0)
1. Why not make a test case.
2. Describe "fake lable".
3. This seems utterly pointless...
closed account (9y8C5Di1)
1. With this you could prevent memory leaks.
2. Fake label, is an attached reference to an object. IE. "DOG".
3. Depends on how you see it.

I made an example of this, but i don't have the code anymore.
The result was that i received an error by the compiler while deallocating,
the memory attached to the void pointer.

So what i really was asking, is there a way to get around deallocating feks.
a pointer to a string, with a pointer to a void?

This makes sense according to that pointers holds memory addresses,
so if you assign the right address, why shouldnt you be able to deallocate the memory consume?

Though i am saying this, with no prior knowledge about how C++ actually deallocates memory.
Last edited on
Topic archived. No new replies allowed.