Microsoft KB Archive/27856

= &quot;Formal Parameter Specification Illegal&quot; from BC, but Not QB =

Article ID: 27856

Article Last Modified on 11/21/2006



This article was previously published under Q27856



SUMMARY
For the following statement, the BC.EXE compiler correctly generates the compile-time error message &quot;Formal parameter specification illegal,&quot; while the QuickBasic QB.EXE editor does not give any error message: DECLARE SUB prompt (prompt$) The following is another example with the same symptoms, plus a &quot;Duplicate Definition&quot; error from BC.EXE: DECLARE FUNCTION age# DECLARE SUB prompt (age$) The above error messages result from the requirement in QuickBasic versions 4.0, 4.0b, and 4.5, Microsoft Basic Compiler versions 6.0 and 6.0b, and Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 that procedure and variable names must be different. Therefore, programs cannot contain functions or subprograms whose names are the same as those of variables.

Note that the QB.EXE environment of QuickBasic versions 4.0, 4.0b, and 4.5 and the QBX.EXE environment of Basic PDS 7.0 correctly gives you a &quot;Duplicate Definition&quot; error on the following CALL or SUB statement: CALL PROMPT(PROMPT$) Therefore, the lack of warning of &quot;Duplicate Definition&quot; for the DECLARE statement is a minor issue.



MORE INFORMATION
An error message occurs even in the case in which the variable and procedure names differ by a data-typing character (for example, %, &, !, #, $). The error message displays because the compiler makes no distinction between the variable &quot;prompt$&quot; and the subprogram name &quot;prompt&quot;.

The requirement that procedure and variable names be different was introduced in QuickBasic version 4.0 and Basic Compiler version 6.0. This is not a requirement in earlier versions.

Additional query words: QuickBas BasicCom 4.00 4.00b 4.50 6.00 6.00b 7.00 7.10

Keywords: KB27856

-

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

© Microsoft Corporation. All rights reserved.