Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Array strange behaviour
Message
De
15/11/2003 05:47:36
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Array strange behaviour
Divers
Thread ID:
00850210
Message ID:
00850210
Vues:
51
Hi,

on previous Thread #849929 i put a strange behaviour of the arrays.

Now i have refine and put a more specific question.

On DIMENSION VFP help is write:
point a)
 nRows1 [, nColumns1] 
 Specifies the size of the array to create. If you include just nRows1, a one-dimensional array is created. 
 One-dimensional arrays have one row and nColumn1 columns. ...
after is writed

Point b)
If the array is one-dimensional, an element's subscript is the same as its row number.
For example, the subscript for the element in the third row of a one-dimensional array is 3.
These two affirmations are in contradiction.

Try to compare:
CLEAR
DIMENSION arr0[100],arr1[100,1]	&& compare these

FOR k=1 TO ALEN(arr1)
 arr0[m.k]=m.k
 arr1[m.k]=m.k
 arr100[m.k]=m.k
NEXT

* i aspected these return a error, but:

? arr0[77,1] 		&& return Item 1 -> this confirm point b)
? arr0[1,77]	        && return Item 77 -> this confirm point a)
? arr0[65000,77]	&& return Item 77 -> this confirm point c) aElement is (65000-1)*0+77

? arr1[1,77] 		&& return Item 77
? arr1[65000,77]	&& THIS FIRE A ERROR

* For write, situation change:
arr0[77,1]='i77'	&& THIS FIRE A ERROR then contradict Point b)
arr0[1,77]='i77'	&& THIS FIRE A ERROR then contradict Point a)
arr0[77]='i77'		&& write on Item 77  then confirm Point c)

arr0[65000,77]='i77'	&& THIS FIRE A ERROR
arr1[1,77]='i77'&& write on Item 77
IF you do a complete analyze, you found this :
Point c)
One-dimensional arrays have nRows1 rows and zero columns.
This matching with One-dimensional arrays defined on VCX properties.

Question:
This behaviour is by design, then i can use it, or it is a issue and can to be fixed on future?

Fabio
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform