Microsoft KB Archive/51075

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base


Article ID: 51075

Article Last Modified on 11/21/2006

This article was previously published under Q51075

SYMPTOMS

VARPTR$ can be used only with simple variables and with arrays of variable-length strings. Attempting to use the VARPTR$ function on a $DYNAMIC array is a programming error. However, the QB.EXE versions 4.00, 4.00b, and 4.50 editors will not flag this as an error and will interpret and run programs that use VARPTR$ on $DYNAMIC arrays. The BC.EXE compiler Versions 4.00, 4.00b, and 4.50 correctly flag this as an error and give the error message "Dynamic array element illegal."

This problem has been corrected in QBX.EXE, which comes with Microsoft Basic Compiler Version 7.00 (fixlist7.00).

MORE INFORMATION

The VARPTR$ function is used with both the PLAY and the DRAW statements to return the string representation of the address of a variable. The following code example demonstrates the problem in the QuickBasic editor.

Code Example

     REM $DYNAMIC
     CLS
     TYPE aa
          a AS INTEGER
     END TYPE
     REDIM a(50) AS aa
     a(1).a = 10
     PRINT VARPTR$(a(1).a)
     END
                


Additional query words: QuickBas BasicCom buglist4.00 buglist4.00b buglist4.50 B_BasicCom

Keywords: KB51075