Microsoft KB Archive/62816

= Passed Parameters Incorrectly PRINTed from SUB in Library =

Article ID: 62816

Article Last Modified on 11/21/2006



This article was previously published under Q62816



SYMPTOMS
This article demonstrates a case where PRINTing integer and floating-point numbers from a SUBprogram that is either in a library or in a separate module gives unpredictable results. The problem occurs if the variables are passed to the SUB through the argument list and if several of the variables are separated by commas when PRINTed in one PRINT statement.



STATUS
Microsoft has confirmed this to be a bug in QuickBasic version 4.50 and in Microsoft Basic Compiler versions 6.00 and 6.00b (buglist6.00, buglist6.00b). This problem was corrected in Microsoft Basic Professional Development System (PDS) version 7.00 (fixlist7.00).



MORE INFORMATION
There are several ways to work around this problem. This problem does not occur if you use the /X switch on the compile line. The problem also does not occur if the SUB is part of the module from where it is CALLed or if the variables are passed through COMMON SHARED statements. The problem also does not occur if the variables are PRINTed on separate lines, or are separated by semicolons instead of commas.

The following code shows the problem:

From within QB.EXE 4.50, make a module or library from the following code: DECLARE SUB printsub (a%, b%, c%, d%) SUB printsub (a%, b%, c%, d%) PRINT &quot;1: &quot;, a%, b%, c%, d%   PRINT &quot;2: &quot;, a%, b%, c%, d%    PRINT &quot;3: &quot;, a%, b%, c%, d%    END SUB If you made a Quick library from the above SUBprogram, load the library into QuickBasic version 4.50 as follows:   QB /L libname Then, from within QB.EXE 4.50, run the following main program: ' Program: TEST.BAS DECLARE SUB printsub (a%, b%, c%, d%) CLS CALL printsub(9, 16, 4, 70)  'the values do not matter

Output
  1:             9             16            4             70 2:            9             21317         4             70   3:             9             21317         4             70 To work around this problem, compile with the /X option, as follows:   BC /X TEST.BAS ;

Additional query words: QuickBas SR# S900515-50 buglist4.50

Keywords: KB62816

-

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

© Microsoft Corporation. All rights reserved.