ID: Q115700
2.50 2.50a 2.50b 2.60 | 2.00 2.50 2.50a 2.50b 2.60 | 2.50b 2.50c
WINDOWS | MS-DOS | MACINTOSH
kbprg kberrmsg kbprb
The information in this article applies to:
The compiler produces the error message "Attempt to use FoxPro function as an array" when you are compiling dBASE IV code in FoxPro.
FoxPro allows square brackets or parentheses to be used with arrays or functions. dBASE does not allow brackets and parentheses to be used interchangeably. FoxPro will therefore produce this error message if the name of a FoxPro function (or reserved word) is used as the name of an array.
For example, the following code produces the error in FoxPro:
DECLARE abs[1,1]
Rename the array so its name does not conflict with the name of an existing FoxPro function. For example, change this statement
DECLARE abs[1,1]
to this:
DECLARE newabs[1,1]
Since there is no FoxPro function named "newabs", a compiler error is not
generated when the code is compiled.
The following statements are valid in FoxPro:
? myfunc("hello")
? myfunc["hello"]
DECLARE myarray(1,1)
DECLARE myarray[1,1]
dBASE IV does not allow brackets to be used with functions and does not
allow parentheses to be used with arrays. The following statements are
valid in dBASE IV 2.0:
? myfunc("hello")
DECLARE myarray[1,1]
The following statements are not valid in dBASE IV 2.0:
? myfunc["hello"]
DECLARE myarray(1,1)
Since dBASE does not allow brackets and parentheses to be used
interchangeably, dBASE can determine whether a statement is referring to an
array or a function by the type of brackets used in the statement.
Since FoxPro does allow brackets and parentheses to be used interchangeably, FoxPro cannot determine whether a statement refers to an array or a function. Therefore, when the FoxPro compiler encounters an expression that refers to an array with the same name as a FoxPro function, the compiler assumes the statement refers to the FoxPro function and generates an appropriate error message. This problem can be demonstrated with the following statement:
DECLARE abs[1,1]
This statement will compile under dBASE IV without error, but will not
compile under FoxPro.
If the "Attempt to use FoxPro function as an array" error message occurs when you are compiling dBASE IV code, and the dBASE IV compiler does not produce an error message when compiling the code, an array whose name conflicts with the name of a FoxPro function might be used in the code.
Additional reference words: FoxMac FoxDos FoxWin 2.00 2.50 2.50a 2.50b 2.60 2.50c errmsg err msg parens parenthesis KBCategory: kbprg kberrmsg kbprb KBSubcategory: FxinteropDbase
Last Reviewed: October 22, 1998