
Fred Bertsch wrote:
I don't like that 1-hack for the NULL values in offset_ptr and I don't understand why it's necessary. If NULL is outside the memory segment -- so what? NULL should never be dereferenced anyway... There should be a "just works" solution and there's no need for parametrization, here. Maybe I don't understand the problem correctly.
That's a good point. Is it possible to have a null offset_ptr point to NULL? (-this, essentially) It might not be. I can imagine potential problems with this on a CPU architecture that placed registers near 0, though.
You mean hardware registers like vector interrupts? Well if you don't dereference there's no problem and if you dereference you have to debug anyway... But my suggestion has a very fundamental flaw: When an offset pointer in process a sets the offset to '-this' (resulting in NULL), then the offset pointer in process b would add his (very own) 'this' and *not* get NULL. Sorry for my stupidity attack, Tobias