Hi folks,
Frank Heckenbach wrote:
For these purposes, you still could pass a store pointer as a parameter. (Nobody prevents you from defining "Procedure foo ( bar: store )", since you never explicitly write "bar:= baz" or something.)
I don't understand. Passing a value parameter is almost the same as an assignment. I.e., if the procedure disposes of the store pointer parameter, the also store pointer in the caller gets invalid which should not happen.
Where did I say that?
That was my first idea. The second one (quoted here) would be:
New (s); { internally: New (s); New (s^); } Foo (s^); { internally: Foo (s^^); } r := s; { internally: r := s; } Dispose (s); { internally: Dispose (s^); s^ := nil; } Foo (r^); { now r^ = nil, so error }
But you could never Dispose (s) (internally) because then r would be dangling, so you have a kind of memory leak.
Seems like the same idea Joe and I discussed in another mail, only one level higher...
Apparently we have rather different usages in mind. For my (and GPC/GCC's) purposes, linked lists are a basic building block, i.e., almost everything is a superset of linked lists (e.g., doubly linked lists, trees, graphs, ...).
It's as basic for me, too... Figure that was the reason why I overlooked it. Linked lists were a thing I took for granted.
Bye
Markus