[Gambas-user] Question on string[]

Bodard Fabien gambasfr at ...11...
Tue Dec 14 19:54:50 CET 2004


Le mardi 14 Décembre 2004 17:51, Eilert a écrit :
> Bonsoir Laurent,
>
> Laurent Carlier schrieb:
> > Le Lundi 13 Décembre 2004 15:19, Eilert a écrit :
> >>Hi,
> >>
> >>I just found that it's possible to re-define a module-public string
> >>array from within the same sub - is that allowed?
> >>
> >>static myArray as string[]
> >>
> >>sub myProcedure()
> >>.
> >>.
> >>.
> >> myArray = new string[]
> >>.
> >>.
> >> myArray.Add(something...)
> >>end sub
> >>
> >>So if I call myProcedure again, no complaint, and everything runs
> >>through again like expected :-) But - what happens here? Is myArray made
> >>  again, i. e. like REDIM or is a copy made? Buffer overflow...?
> >>
> >>Rolf
> >
> > The first myArray is a global variable, the second one is a local
> > variable. In myProcedure sub, you have only access to the local one (as
> > it have the same name !) and of course this one is destroyed at the end
> > of the sub.
>
> No, the first myArray is an object which is Null if not initialized. In
> the myProcedure it is initialized, but everyone within that module has
> access to it. That is necessary because this array may be needed e. g.
> for inserting data into a tableview.
>
> What I wanted to know is just, may I make ever new ones over and over
> again, or will I run into some buffer problems at some point?
>
> Rolf

The better way ... to us to understansd what you meen is to make a short 
sample that contain your problem... Make it and send it to the mailinglist 

add on it a file with your explanation.

Fabien Bodard


>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list