Page 1 of 1
Posted: Thu Aug 08, 2002 11:29 am
by BackupUser
Restored from previous forum. Originally posted by traumatic.
i wonder what's the best way to dynamically allocate arrays inside structures.
well, even a good way would be enough
imagine the following example:
Code: Select all
Structure one
x.f
y.f
EndStructure
Structure two
something.one[#dont_know_how_much]
EndStructure
'#dont_know_how_much' isn't known at start.
the value needed is generated at runtime.
how would i adjust 'something.one' to fit?
hope i explained myself well enough..
tia,
traumatic
Posted: Sat Aug 10, 2002 8:37 am
by BackupUser
Restored from previous forum. Originally posted by traumatic.
anyone?
Posted: Sat Aug 10, 2002 2:52 pm
by BackupUser
Restored from previous forum. Originally posted by El_Choni.
I don-t know the rest of the people, but personally I don-t understand the question, sorry. God, this keyboard is a mess!
El_Choni
Posted: Sat Aug 10, 2002 3:06 pm
by BackupUser
Restored from previous forum. Originally posted by traumatic.
[...]but personally I don-t understand the question[...]
i really don't know how to define my problem other than the way i did...
i just want to know a good way to allocate arrays inside structures dynamically with purebasic...
anyone out there understanding me? thank you for any help!
Posted: Sat Aug 10, 2002 11:11 pm
by BackupUser
Restored from previous forum. Originally posted by tranquil.
I think I know your problem, I have the same too in my app.
There is no way atm to add dimensions to a structure yet, as far as I know.
The best way would be to use a linked list in that case which is much faster and does not need so much memory. But for this way, I have to completely recode my app and this is a very huge work.
Mike
Tranquilizer/ Secretly!
http://www.secretly.de
Registred PureBasic User
Posted: Sun Aug 11, 2002 1:25 am
by BackupUser
Restored from previous forum. Originally posted by ricardo.
If i understand you need to redim the array but as far as i know its not possible on PB until now.
As tranquil says maybe lists are the solution.
Maybe one wish for PB is to manage arrays as other basic does.
Posted: Sun Aug 11, 2002 8:13 pm
by BackupUser
Restored from previous forum. Originally posted by El_Choni.
But it IS possible to redim an array. Only I don-t know if doing it resets data or not.
El_Choni
Posted: Sun Aug 11, 2002 8:49 pm
by BackupUser
Restored from previous forum. Originally posted by traumatic.
But it IS possible to redim an array. Only I don-t know if doing it resets data or not.
yes, using dim you can resize an array and yes, the contents gets deleted.
my problem is the usage of arrays inside structures.
using somearray[] inside a structure isn't a 'real' array one could change with dim, is it?
you also can't work with dim while setting up a structure, can you?
Posted: Sun Aug 11, 2002 9:09 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.
Structures cannot be changed at runtime (logical).
You have to use another way.
cya,
...Danilo
(registered PureBasic user)