Hi Jean,
thanks for your reply, and syggestion. I think I cannot implement, because I have many places where I should point to that vector. So I would need something different. To clarify what I'm doing, here's an example:
( aDynamicVector is a schema type, like the follwing:
aDynamicVector = ^TVecDob; TVecDob (Size: Integer) = array [ 1 .. Size ] of double; )
procedure resize ( var kets: aDynamicVector );
new ( kets, 10 )
........ ........
end;
and then I call it:
resize ( aKet );
where for instance the size of aKet was 9.
I hope I have explained myself better, please let me know.
Best regards
Silvio
On Tue, 2 Sep 2003, Jean-Pierre Vial wrote:
| I am not sure that I understand your problem; here is a possible solution | to my interpretation of your message (dirty trick, will be hard to maintain in | a few months, or by somebody else) | 1 make sure that there exists only one thing pointing to your vector | in the calling code. Let it be V | | 2 instead of passing the reference bizarre(var V: ... | pass a pointer to it (it will be something much alike a pointer to a pointer) | bizarre(addr(V) ... or something like that | | 3 inside your procedure, create your new vector, | copy the relevant part of the old one into the new one, | free the old one | using the pointer, change V in the calling code so that it points to the new | vector | | The elements will be transferred from the old vector into the new one, so they | are preserved, but the address of V will be changed, | this is why you must be sure that it exists in only one place. | | | The occupation of the stack will not grow more than needed, but fragmentation | may be as much a nuisance as occupation. | -- | Jean-Pierre Vial |