Twice-Called String FUNCTION May Fail in QB/QBX Quick Library (58955)
This article was previously published under Q58955
SYMPTOMS
In the QBX.EXE or QB.EXE environment, a STATIC string FUNCTION located
in a Quick library (.QLB) that is invoked twice within the same PRINT
or assignment statement may give incorrect results. This problem only
exists with a STATIC string FUNCTION in a Quick library that is
invoked twice in one statement with a plus sign (+, for string
concatenation) connecting the two invocations. This problem can be
worked around easily by using temporary variables and splitting the
statement into two statements. The problem does not occur in compiled
and linked .EXE programs.
STATUS
Microsoft has confirmed this to be a bug in the QBX.EXE
environment shipped with Microsoft Basic Professional Development
System (PDS) versions 7.00 and 7.10 for MS-DOS, in the QB.EXE
environment shipped with Microsoft Basic Compiler versions 6.00 and
6.00b for MS-DOS, and in the QB.EXE environment shipped with Microsoft
QuickBasic versions 4.00, 4.00b, and 4.50 (buglist4.00, buglist4.00b,
buglist4.50) for MS-DOS. We are researching this problem and will post
new information here in the Microsoft Knowledge Base as it becomes
available.
Code Example
The following code example demonstrates the problem:
FUNCTION Foop$(x$) STATIC
Foop$ = x$ + "Z"
END FUNCTION
The module above should be compiled and built into a Quick library,
then QBX should be started with that Quick library. Calling this
FUNCTION twice in a row gives the incorrect results, as follows:
DECLARE FUNCTION Foop$(x$)
PRINT Foop$("abc")+Foop$("def")
This example prints "defZdefZ" instead of correctly printing "abcZdefZ".
Modification Type: |
Minor |
Last Reviewed: |
1/8/2003 |
Keywords: |
KB58955 |
|