Page 1 of 1
@Fred: Questions about setting array to different address
Posted: Sun Apr 09, 2006 11:24 am
by Hades
It is possible to set an array to a different address.
Code: Select all
Dim A.l(3,3)
A() = AllocateMemory(128)
- Is this a feature that will work in future too?
- What happens with the original memory area of the array? Is it freed, or should I reset the array to it's original address?
btw.: excellent work with Beta 9, Fred. PB gets better and better...

Posted: Mon Apr 10, 2006 9:10 am
by mdp
Code: Select all
Dim A.l(8) : A(0)=123
p0 = @A() : Debug p0
A() = AllocateMemory(128)
p1 = @A() : Debug p1
Debug PeekL(p0)
As you can see, it does not seem to be freed
Posted: Mon Apr 10, 2006 1:51 pm
by Nik
freeing<>filling with zeros
Posted: Mon Apr 10, 2006 2:02 pm
by Fred
You should not use this trick, as it's not granted to be future proof.
Posted: Mon Apr 10, 2006 2:17 pm
by mdp
Yes Nik,
It was just a guess based on some results.
Code: Select all
Dim a(10) : Debug @a()
Dim b(10) : Debug @b()
Dim c(10) : Debug @c()
Dim d(10) : Debug @d()
c()=AllocateMemory(10) : Debug @c()
Dim e(10) : Debug @e() ; @e() still follows @d()
Code: Select all
Dim a(10) : Debug @a()
Dim b(10) : Debug @b()
Dim c(10) : Debug @c()
Dim d(10) : Debug @d()
Dim c(20) : Debug @c()
Dim e(10) : Debug @e() ; @e() replaced @c()
It meant: "Apparently, you could try"
[edit]
but I see the official answer arrived...
Posted: Mon Apr 10, 2006 3:14 pm
by Hades
@Fred
Thank you for your answer, but it's a shame it isn't future proof.
Sure, Pointers are always possible, but at the moment I'm indexing from one array in memory into another array in memory, and that's a bit ugly with Pointers, at least for development.
I'm writing some fairly complex code here and have already some trouble keeping track what's going on. :roll: So I try to make everything as simple as possible.
Posted: Mon Apr 10, 2006 3:57 pm
by Fred
It's not a shame, you are dealing with PB internals which are not documented, what did you expect ?
Posted: Sun May 07, 2006 3:39 am
by chen
Fred wrote:you are dealing with PB internals which are not documented, what did you expect ?
What does this mean?
that knowledge is not for us... or we are going to have soon that documentation...
:roll:
Posted: Sun May 07, 2006 9:00 am
by maw
I assume Fred means exactly what he said. PB internals are not documented, so that knowledge is not for us. And I bet they wont be documented in the foreseeable future either because that simply isn't the scope of the project. It would take way to much time from the development to do it in the first place and it would also make all future develompent take much longer because every little change has to be documented. And there would still be no guarantee that your code would work in a future version, just that it would be documented that it wouldn't work anymore
