Microsoft KB Archive/58955

= Twice-Called String FUNCTION May Fail in QB/QBX Quick Library =

Article ID: 58955

Article Last Modified on 11/21/2006



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$ + &quot;Z&quot; 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$(&quot;abc&quot;)+Foop$(&quot;def&quot;) This example prints &quot;defZdefZ&quot; instead of correctly printing &quot;abcZdefZ&quot;.

Additional query words: QuickBas BasicCom buglist6.00 buglist6.00b buglist7.00 buglist7.10

Keywords: KB58955

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.