Microsoft KB Archive/78893

= BC &quot;Out of Memory&quot; on Calculation with User Type Passed to SUB =

Article ID: 78893

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft Visual Basic for MS-DOS
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q78893



SYMPTOMS
The BC.EXE compiler may give an &quot;Out of Memory&quot; error message when compiling a program that uses elements of a user-defined type in calculations made inside a SUB program to which the typed variable was passed as a parameter. Several workarounds are shown below.



STATUS
Microsoft has confirmed this to be a bug in the Standard and Professional Editions of Microsoft Visual Basic for MS-DOS, version 1.0; and Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2, versions 7.0 and 7.1 (buglist7.00 and buglist7.1). We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
The following code demonstrates the problem. Compiling the program below in BC.EXE will result in an &quot;Out of Memory&quot; error message: TYPE xytype a1 AS INTEGER a2 AS INTEGER a3 AS INTEGER a4 AS INTEGER a5 AS INTEGER a6 AS INTEGER END TYPE DIM var AS xytype DEFINT A-Z SUB test (var AS xytype) var.a6 = var.a4 * x           var.a5 = var.a4 + var.a3            var.a2 = var.a5            var.a3 = var.a4        END SUB



WORKAROUND

 * Re-arrange the user type. For example, moving a1 to the last position in TYPE xytype corrects the problem.
 * Compile with the /X compile option. Normally, /X indicates the program contains RESUME statements, but it also inhibits some of the compiler's optimizations.
 * Make Var into a variable in COMMON SHARED, thus removing it from the parameter list.

Additional query words: VBmsdos buglist1.00 7.10 7.00 1.00

Keywords: KB78893

-

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

© Microsoft Corporation. All rights reserved.