Bad Results with Recursion of STATIC Procedure in QB.EXE (40553)
This article was previously published under Q40553
SYMPTOMS
The use of the STATIC clause in recursive functions or SUBprograms should
be avoided. Using STATIC may cause you to overwrite values from a previous
CALL. For example, recursively CALLing a STATIC SUBroutine and decrementing
the passed parameter actually will change the value of the parameter when
the procedure returns at the END SUB statement. However, the QuickBasic
editor incorrectly allows the recursive use of a STATIC subroutine or
function without any side effects of changing the passed parameters. This
problem can lead to subtle programming errors because the incorrect results
don't become apparent until compile time.
STATUS
Microsoft has confirmed this to be a bug in QuickBasic Versions 4.00,
4.00b, and 4.50 and in the QB.EXE program that is shipped with the
Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2.
We are researching this problem and will post new information here in the
Microsoft Knowledge Base as it becomes available.
Modification Type: |
Minor |
Last Reviewed: |
1/9/2003 |
Keywords: |
KB40553 |
|