Microsoft KB Archive/77244

= &quot;Parameter Type Mismatch&quot; with Variable Name Same as Parameter =

Article ID: 77244

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS

-



This article was previously published under Q77244



SYMPTOMS
The BC.EXE compiler incorrectly reports &quot;Parameter type mismatch,&quot; and possibly &quot;Duplicate definition,&quot; when a module contains a variable in the module level that has the same name as a parameter of a SUB or FUNCTION statement in the same module and the following conditions are met:


 * The type of the variable in the module level and the parameter in the SUB or FUNCTION are different.
 * The variable is defined with &quot;DIM as &quot;.
 * The parameter does not have an &quot;AS &quot; clause.

To work around this problem, write the SUB or FUNCTION parameter with an &quot;AS &quot; clause.



STATUS
Microsoft has confirmed this to be a bug in BC.EXE in QuickBasic versions 4.0, 4.0b, and 4.5. This problem was corrected in Microsoft Basic Professional Development System (PDS) version 7.1 (fixlist7.10).



MORE INFORMATION
If the SUB parameter is declared with a type specifier, as in  SUB sub1 (a!) then BC.EXE incorrectly reports &quot;Duplicate definition&quot; in addition to &quot;Parameter type mismatch.&quot;

The following code example demonstrates the problem: DECLARE SUB sub1 (a) DIM a AS STRING y = 123 CALL sub1(y) END SUB sub1 (a)        ' Incorrectly causes &quot;Parameter type mismatch&quot; ' Workaround: change to SUB sub1 (a AS SINGLE) PRINT &quot;a =&quot;; a  END SUB

Additional query words: QuickBas 4.00 4.00b 4.50 buglist4.00 buglist4.00b buglist4.50

Keywords: KB77244

-

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

© Microsoft Corporation. All rights reserved.