CBFalconer wrote:
The question is how much overhead to put on pointer dereference. In Pascal, unlike C, we can tell such from VAR dereference through the type system. There is a non-trivial problem involved in passing that knowledge through functional parameters. This can be handled by performing the check at the point of passage, and thenceforce treating as a VAR. Any such mechanism as outlined above depends on intimate knowledge of the actual heap allocation mechanism, and involves overhead. VAR dereference is generated directly by the compiler, and known correct (what is not necessarily known is the validity of an offset, or index, value).
If the actual var parameter is a dereferenced pointer which was disposed meanwhile, even var dereferencing can fail. Of course, disposing a pointer while a reference exists is already invalid, so you could instead try to check at `Dispose' time. But AFAICS, this would require reference counting again, or something like this ... Frank -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE D101 CD02 4C9D 0FE0 E5E8