KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q51075: QB 4.x Editor Does Not Flag VARPTR$ Error, but BC.EXE Does

Article: Q51075
Product(s): See article
Version(s): 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | buglist4.00 buglist4.00b buglist4.50 B_BasicCom | mspl13_basic
Last Modified: 30-NOV-1989

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).

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

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.