Restored from previous forum. Originally posted by PB.
I've never used structures before, but I think my vis2pure app would benefit by
using them. Currently, vis2pure has individual arrays for all gadget properties,
for example: gn$(x) for gadget name, gv(x) for gadget visible, etc. However, as
I'm adding more and more properties for each gadget, I think that perhaps using
structures would be a better and more efficient approach. Am I right?
Basically, I guess I'm asking: Is using structures a better way to go instead of
using individual arrays? Do they save memory, etc?
PB - Registered PureBasic Coder
Structure question
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fred.
Structure are faster and more modular than using tons of Arrays. It doesn't save memory, but the structure solution is definitely cleaner, go for it ! You can combinate the structure with the linkedlist and you will get an expandable, low memory solution. If you need more info of how to use them, just tell us.
Fred - AlphaSND
Structure are faster and more modular than using tons of Arrays. It doesn't save memory, but the structure solution is definitely cleaner, go for it ! You can combinate the structure with the linkedlist and you will get an expandable, low memory solution. If you need more info of how to use them, just tell us.
Fred - AlphaSND
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
elements without reading elements 1-4 first... so I don't understand what
you mean by the above?
PB - Registered PureBasic Coder
Hi Fang, I just tried a structure and I was able to get element 5 out of 10You cannot reference an element in a structure directly like a(15) (get element 15 from array 'a', you have to loop through all items to get to the one you want.
elements without reading elements 1-4 first... so I don't understand what
you mean by the above?
PB - Registered PureBasic Coder
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fred.
Fred - AlphaSND
I think than Fang talked about LinkedList. With linkedList, to get the 15th elem, you have to do a loop on the 15th first..Hi Fang, I just tried a structure and I was able to get element 5 out of 10
elements without reading elements 1-4 first... so I don't understand what
you mean by the above?
Fred - AlphaSND
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm