[Gambas-user] When to use GB.NewArray or GB.Array.New

Randall Morgan rmorgan62 at ...626...
Thu Feb 16 21:46:10 CET 2012


Hi,

I am experimenting with arrays in C components. I have looked at the
documentation on arrays and see that there are two types of arrays. It
looks like GB.NewArray simply reserves memory and GB.Array.New creates a
new GAMBAS array object.

My question is: When is it appropriate to use each of these types. To me it
seems that GB>NewArray would be used only for temporary memory allocation
as in a function and therefore should be freed with GB.FreeArray before
exiting the function. Also, that GB.ArrayNew would be used anytime you need
a persistent array such as returning an array object or using the array as
a class member/property. Is this correct?

Thanks for the clarification!


-- 
If you ask me if it can be done. The answer is YES, it can always be done.
The correct questions however are... What will it cost, and how long will
it take?



More information about the User mailing list