Microsoft KB Archive/87637

{|
 * width="100%"|

Allocating Space in the Far Heap in Near Data Models

 * }

Q87637

7.00 | 1.00 1.50 MS-DOS | WINDOWS kbprg -- The information in this article applies to: - Microsoft C/C++ compiler for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, versions 1.0 and 1.5 -- SUMMARY ======= To force an object to be allocated in the far heap in a small or medium memory model C++ program, use the __far keyword in front of the object being allocated. For example, where T is either an implicit or user-defined type, the syntax would be: new __far T; This returns a far pointer to an object of type T allocated in the far heap. However, if type T is a near class, the following error will be generated: C2512: no appropriate default constructor available This error is generated because the far pointer cannot be converted to a near pointer when the constructor is invoked. The programmer must then declare the class as a far class or provide a special constructor that takes a far &quot;this&quot; pointer. Additional reference words: kbinf 7.00 1.00 1.50 KBCategory: kbprg KBSubcategory: CPPLngIss

Keywords : kb16bitonly

Issue type :

Technology : kbVCsearch kbAudDeveloper kbvc150 kbvc100