Microsoft KB Archive/76665

= Mismatched Fixed-length String Passed by Value Hangs QB 4.5 =

Article ID: 76665

Article Last Modified on 11/21/2006



This article was previously published under Q76665



SYMPTOMS
Passing a fixed-length string by value to a subprogram will hang QB.EXE if all the following conditions are met:


 * The subprogram expects two or more parameters, the first of which is a string.
 * The call to the subprogram has fewer arguments than the subprogram has parameters.
 * A fixed-length string is passed by value in the first argument position.

Normally the QB.EXE environment will report an &quot;Argument Count Mismatch&quot; error when you fail to pass the correct number of parameters. However, if all the above conditions are met, QB.EXE will hang when you choose the Start or Make EXE File command from the Run menu. This problem can be avoided by ensuring that you pass the correct number of parameters to the SUB.



STATUS
Microsoft has confirmed this to be a bug with the QB.EXE environment of Microsoft QuickBasic 4.5. We are researching the problem and will post new information here as it becomes available.

This problem does not occur in QuickBasic 4.0 or 4.0b or Basic PDS 7.1 (fixlist7.10). In these versions, the programming environment flags the incorrect number of arguments as expected with the &quot;Argument Count Mismatch&quot; error message.



MORE INFORMATION
The following code example demonstrates the problem. WARNING: Running or trying to make an .EXE file from this code will cause your computer to hang. '--- DECLARE SUB Mysub (p1$, p2$) ' Note that all conditions are met: ' Two parameters and less than two arguments DIM arg AS STRING * 10 ' A fixed-length string (length doesn't matter)

Mysub (arg)  ' One string passed by value. (Parentheses around each             ' argument denote passing by value.) ' or you can use the following equivalent syntax to pass by value: ' CALL Mysub ((Argument))

' NOTE: When you use an explicit CALL statement in the syntax, the ' argument list must be enclosed in parentheses as shown. The extra ' interior set of parentheses is required for passing by value.

END

SUB Mysub(p1$, p2$)  ' The types of the second and following END SUB            ' parameters do not matter as long as the ' first one is a string.

Additional query words: QuickBas 4.50 SR# S910916-164 buglist4.50

Keywords: KB76665

-

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

© Microsoft Corporation. All rights reserved.