Hi folks,
da Silva, Joe wrote:
No, the last statement cannot result in a new assignment for the reference pointer. That's just unacceptable. That's why Frank was saying you needed "double pointers", so that you could specifically set the reference pointer to "nil" when you disposed it's corresponding store pointer.
Exactly. The other method would be fatal.
You could also search the reference pointers when disposing a store pointer, to find out which of these are affected, but that would be inefficient (like GC;-).
But it's done in several languages -- e.g. for interfaces in Delphi. There you don't have an explicit store pointer, but a reference counter keeps track on every piece of memory; if the number of pointers referencing it decreases to 0, it is automatically disposed of. This requires exactly what you say: Searching for all references to a piece of memory, whenever a pointer is set away from it.
Bye
Markus