Microsoft KB Archive/48251

{|
 * width="100%"|

DOC: Mixed-Language Examples for Calling Pascal Are Incorrect

 * }

Q48251

6.00 6.00a 6.00ax 7.00 | 6.00 6.00a | 1.00 1.50 MS-DOS | OS/2 | WINDOWS kbprg kbdocerr -- The information in this article applies to: - Microsoft C for MS-DOS, versions 6.0, 6.0a, and 6.0ax - Microsoft C for OS/2, versions 6.0 and 6.0a - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, versions 1.0 and 1.5 -- SUMMARY ======= In the &quot;Microsoft C Advanced Programming Techniques&quot; manual (APT) that shipped with Microsoft C versions 6.0, 6.0a, and 6.0ax, the &quot;Microsoft C/C++ Programming Techniques&quot; manual that shipped with version 7.0, the &quot;Microsoft Mixed-Language Programming Guide&quot; provided with C versions 5.0 and 5.1, MASM versions 5.0 and 5.1, and Pascal version 4.0, there is a sample Pascal module, Pfun, that is incorrect. Pfun can be found in the following locations: In the APT -- - Page 295, Section 12.7.2 &quot;Calling a Pascal Function from C&quot; In the Programming Techniques manual - Page 248, Section 11.7 &quot;Calling a Pascal Function from C&quot; (7.0) - Page 173, Section 8.7 &quot;Calling a Pascal Function from C&quot; (8.0) In the Mixed-Language Guide --- - Page 30, Section 2.5.2 &quot;Calling Pascal from Basic -- Function Call&quot; - Page 44, Section 3.5.2 &quot;Calling Pascal from C -- Function Call&quot; - Page 57, Section 4.5.2 &quot;Calling Pascal from FORTRAN -- Function Call&quot; If the Pascal source code shown on these pages is compiled, the following errors occur: 21 7 begin = 22 8 Fact := Fact * n; 8 --^Warning 171 Insert ( 8 ^268 Cannot Begin Expression Skipped 8 ---^Warning 155 ; Assumed, 8 ---^257 Parameter List Size Wrong Begin Ski MORE INFORMATION ================ To obtain correctly compiled code, all of the incorrect references to Fact must be removed and replaced by a temporary variable. The following source code contains the necessary changes to the Pfun module so that it will compile and run without any errors: module Pfun; function Fact (n : integer) : integer; {Integer parameters received by value, the Pascal default. } var temp : integer; begin temp := 1; while n > 0 do begin temp := temp * n; n := n - 1; end; Fact := temp; end; end. Note: There is an incorrect reference to the errors in the Fact function in the Pascal version 4.0 README.DOC file. This correction does not work properly. Additional reference words: 6.00 6.00a 6.00ax 7.00 1.00 1.50 KBCategory: kbprg kbdocerr KBSubcategory: CLngIss

Keywords : kb16bitonly

Issue type :

Technology : kbVCsearch kbAudDeveloper kbPTProdChange kbvc150 kbvc100 kbCCompSearch kbZNotKeyword3 kbCComp600DOS kbCComp600aDOS kbCComp600axDOS kbCComp600OS2 kbCComp600aOS2 kbCVC700DOS