Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Xbase Fox > VFP Array Eleme...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 830 of 852
Post > Topic >>

VFP Array Element Handling Gotcha

by Gene Wirchenko <genew@[EMAIL PROTECTED] > Feb 12, 2008 at 04:20 PM

I just got bit in a minor way with the way that VFP handles array
elements.  Consider the following code:

   local twod(10,2)
   for i=1 to 10
      for j=1 to 2
         twod(i,j)=10*i+j
         endfor
      endfor
   ? twod(4,3)

     Note the array dimensions and the reference.  The reference is
treated as being the third element starting in row 4 with VFP not
checking against the declared dimension.  The reference is treated as
referring to twod(5,1), not as being an error.

     The docs do say that 2-D arrays can be accessed as 1-D.  The
implementation appears to be more general than that.  Forewarned is
forearmed and all that.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
     I have preferences.
     You have biases.
     He/She has prejudices.




 3 Posts in Topic:
VFP Array Element Handling Gotcha
Gene Wirchenko <genew@  2008-02-12 16:20:41 
Re: VFP Array Element Handling Gotcha
Rush Strong <rpstrong@  2008-02-13 01:44:41 
Re: VFP Array Element Handling Gotcha
Rush Strong <rpstrong@  2008-02-13 01:49:27 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Fri Jul 4 14:48:23 CDT 2008.