Microsoft KB Archive/48479

= Correction for Basic Calling POWER2, &quot;Mixed-Language&quot;: Page 81 =

Article ID: 48479

Article Last Modified on 11/21/2006



This article was previously published under Q48479



SUMMARY
The following correction applies to Page 81 of the &quot;Microsoft Mixed-Language Programming Guide,&quot; which is provided with C Versions 5.00 and 5.10, Macro Assembler Versions 5.00 and 5.10, and Pascal Version 4.00 (but is NOT provided with QuickBasic Version 4.00, 4.00b, or 4.50, Microsoft Basic Compiler Version 6.00 or 6.00b, or Microsoft Basic Professional Development System (PDS) Version 7.00).

On Page 81 of the &quot;Microsoft Mixed-Language Programming Guide,&quot; the Basic program example is incomplete. The structure of the code as shown incorrectly returns a value of 0 (zero) for the POWER2 assembler function. This error occurs because POWER2(3,5) is interpreted by Basic to be an array as opposed to a FUNCTION as it was intended to be.



MORE INFORMATION
To correct the program, add the following line after the DEFINT A-Z statement: DECLARE FUNCTION Power2 (x, y) The program in its entirety should read: DEFINT A-Z DECLARE FUNCTION Power2 (x, y)  PRINT &quot;3 times 2 to the power of 5 is &quot;; PRINT Power2(3,5) END This Basic program can be compiled with Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50 for MS-DOS, Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2, or Microsoft Basic PDS Version 7.00 for MS-DOS and MS OS/2.

The assembly language routine on Page 82 is correct and returns the expected values when you add the above DECLARE in the Basic code.

Additional query words: QuickBas BasicCom

Keywords: KB48479

-

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

© Microsoft Corporation. All rights reserved.