Microsoft KB Archive/81453

= &quot;Variable Name Not Unique&quot; if Variable Name Same as Parameter =

Article ID: 81453

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1
 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS

-



This article was previously published under Q81453



SYMPTOMS
The BC.EXE compiler incorrectly reports &quot;Variable name not unique&quot; when a module contains the following, in order:   In the module level, a string constant that ends with a period character. For example, any one of the following statements: PRINT &quot;.&quot;; a$ = &quot;abc.&quot; c = ASC(&quot;.&quot;) CHDIR &quot;..&quot;   In the module level, a variable that was not declared with &quot;DIM AS &quot;. For example, one of the following statements: y = 1 PRINT y   In a SUB or FUNCTION procedure, a parameter declared with &quot;DIM AS ,&quot; where has the same name as the variable in the module-level and  is a user-defined type name. For example: SUB s (y as userType) 



STATUS
Microsoft has confirmed this to be a bug in the BC.EXE compiler of Microsoft Basic Compiler versions 6.0 and 6.0b; Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1; and QuickBasic versions 4.0, 4.0b, and 4.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



Steps to Reproduce Problem
The following example program has no output, but when you try to compile it, it demonstrates the problem. TYPE t x AS INTEGER END TYPE

' Un-remark the following line to work around the problem ' DIM y AS SINGLE PRINT &quot;.&quot;; y

SUB s (y AS t) ' BC.EXE incorrectly reports &quot;Variable name not unique&quot;

END SUB

>From within the environment, the output will be : &quot;. 0&quot;. But if you try to compile it, BC.EXE will report the problem on the SUB statement.

To work around this problem, declare the module-level variable with &quot;DIM ... AS ....&quot; For example:

' Insert this line of code before the PRINT statement DIM y AS SINGLE

Additional query words: QuickBas BasicCom buglist4.00 buglist4.00b buglist4.50 4.00 4.00b 4.50 6.00 6.00b 7.00 7.10 buglist6.00 buglist6.00b buglist7.00 buglist7.10

Keywords: KB81453

-

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

© Microsoft Corporation. All rights reserved.