Labels & Line Numbers Must Be Unique, Even Across Subprograms (20540)






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.

Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: KB20540