On Tue, 09 Jun 2009, Guy Roussin wrote:

Hi,

> I suppose this is not a bug but a pointer behavior.
> I try to create a 2D array and this is what i get :

> local aArray:={}
> asize(aArray,20)
> afill(aArray,{})

In Clipper and Harbour above fills all array items with references
to the same array.

> aeval(aArray,{|x|asize(x,5)})
> aArray[5,2]:="test"
> ? aArray[4,2] // test !

Exactly. If you do not like it then do not use array as AFILL() parameter.
This to lines:
   afill(aArray,{})
   aeval(aArray,{|x|asize(x,5)})
gives exactly the same effect as:
   afill(aArray,array(5))
but you want to make:
   aeval(aArray,{|x,i|aArray[i]:=array(5)})
>
> return (NIL)
> I'll found usefull something like this :
> hb_asize(aArray,20,5)

What's wrong in
   aArray := array( 20, 5 )
?

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to