[Gambas-user] Fixed arrays still dynamic

Moviga Technologies moviga at ...3488...
Mon Oct 5 23:41:36 CEST 2015


Ah, yes - it slipped my mind that inline arrays instantiates a new 
object.
My example should rather have been:

Dim aCarBrands As New String[5]

With aCardBrands
   .Add("Volvo")
   .Add("Saab")
   .Add("Fiat")
   .Add("Aston Martin")
   .Add("Skoda")
   .Add("VW")
   .Add("Audi")
End With

So, the (only) purpose of giving it a predefined size is to reserve the 
memory in advance? sCarBrands[] is 0 byte while sCarBrands[4] is 16 
bytes? Will the latter be faster?
So am I right then to say that there are no fixed arrays in Gambas, but 
all are dynamic. It is just that some have preallocated memory? Or how 
about Dim sCarBrands As New String[2, 2]
is this fixed? I cannot seem to find a way to add more to this array 
dynamically.


You mean you prefer this Dim aCarBrands As New String[](5) notation for 
semantic reasons? No technical advantages?




More information about the User mailing list