Allocating Space in the Far Heap in Near Data ModelsLast reviewed: July 17, 1997Article ID: Q87637 |
7.00 | 1.00 1.50
MS-DOS | WINDOWS
kbprg
The information in this article applies to:
SUMMARYTo 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 availableThis 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 "this" pointer.
|
Additional reference words: kbinf 7.00 1.00 1.50
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |