[Gambas-user] gb3: clearing a public embedded array from a procedure

Kevin Fishburne kevinfishburne at ...1887...
Tue Jul 5 02:43:40 CEST 2011


On 07/04/2011 08:25 PM, Benoît Minisini wrote:
>
> Embedded arrays are not Gambas object, their memory is allocated directly
> inside the object where they are declared.
>
> So you can't use Clear(), as that method resizes the array to zero elements.
>
> If you don't want to be confused, just use normal arrays:
>
> 	Public QueueObject As New String[1024]

Excellent, thank you. That was the syntax I was looking for. I was using 
an embedded array by accident, basically, not knowing how to declare one 
normally (or what the difference was).

Since Clear() destroys all the elements, what I really needed was 
"QueueObject = New String[1024]" to erase all the values. It is now 
working and one more bug has died. :)

In a feeble effort to expand my understanding, is there an obvious 
[dis]advantage between using a normal array versus an embedded array?

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list