Microsoft KB Archive/20540

= Labels & Line Numbers Must Be Unique, Even Across Subprograms =

Article ID: 20540

Article Last Modified on 11/21/2006



This article was previously published under Q20540



SUMMARY
This information applies to Microsoft QuickBASIC Versions 1.00, 1.00a, 1.00b, Microsoft BASIC Compiler Version 1.00, and Microsoft BASIC Interpreter Versions 2.00, 2.10, and 3.00 for the Apple Macintosh.

All labels and line numbers used in interpreted program must be unique. No two labels or line numbers can be the same when a program is interpreted, even if they are in separate subprograms.

BASIC interpreter Version 2.00 does not properly warn you about duplicate labels, and incorrect branching can occur when using duplicate labels in Version 2.00.

BASIC interpreter Versions 2.10 and 3.00 and the interpreter in QuickBASIC properly stop the program with an error message "Duplicate Label" when duplicate labels are found at run time.

The BASIC compiler Version 1.00 and the QuickBASIC Compiler treat line numbers and labels locally and will not generate an error message if there are duplicates in separate subprograms. This is an undocumented difference between compiled and interpreted programs.

Additional query words: BasicCom MQuickB

Keywords: KB20540

-

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

© Microsoft Corporation. All rights reserved.