Microsoft KB Archive/64431

= BUG: QuickBasic Interpreter Allows Duplicate Line Numbers =

Article ID: 64431

Article Last Modified on 11/21/2006



This article was previously published under Q64431



SYMPTOMS
The interpreter in Microsoft QuickBasic for Macintosh incorrectly allows duplicate numeric line labels within a program.

Microsoft has confirmed this to be a bug in Microsoft QuickBasic versions 1.00 and 1.00a for Macintosh. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

At compile time, the compiler in QuickBasic correctly gives the &quot;Duplicate label&quot; error for duplicate line numbers. Note that the interpreter in QuickBasic correctly gives the error &quot;Duplicate label&quot; if the label begins with an alphabetic letter (A through Z). In other words, the problem occurs in the interpreter for duplicate line numbers, but not for duplicate alphanumeric labels.



MORE INFORMATION
Because the QuickBasic interpreter's line number parser fails to check for duplicates, an unlimited number of lines with the same line number are incorrectly allowed. A GOTO or GOSUB to the repeated line number results in control being passed to the first occurrence of the repeated line number. (Compiling the program correctly gives a &quot;Duplicate label&quot; error.)

The following program, when run in interpretive mode, demonstrates the problem: Code Example

10 GOSUB 37 20 END 37 PRINT &quot;Hello&quot; 37 PRINT &quot;World&quot; 100 ' An intermixed line number to better illustrate the problem. 37 PRINT &quot;How are you doing?&quot; 50 RETURN Note that QuickBasic does not order lines that have line numbers; for example, line 50 can follow line 100 without any numeric order enforced. No line-numbering order is enforced because line numbers are merely another form of line label in the QuickBasic language.   Output from Example ---

Hello World How are you doing?

Additional query words: MQuickB

Keywords: kbbug KB64431

-

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

© Microsoft Corporation. All rights reserved.