Pointers Modified by Microsoft Keywords

The Microsoft keywords __near, __far, __huge, and __based modify types to specify the addressing desired. The following standard conversions between pointers modified by these keywords are performed (provided the types obey the conversion rules discussed elsewhere in this chapter):

A near pointer can be promoted to a far pointer.

Any pointer can be converted to a huge pointer by first converting the pointer to a far pointer, then converting it to a huge pointer.

A huge pointer can be converted to a far pointer. Because far addressing has different implications than huge addressing, the compiler issues a warning.

A pointer based on a near address can be converted to a near pointer.

A pointer based on any segment other than void can be converted to a far pointer.

Microsoft C++ supplies no standard conversions to any form of based pointer or from any form of address that contains or implies segment information (far, huge, or based) to a near pointer.

C++ does not supply a standard conversion from a const or volatile type to a type that is not const or volatile. However, any sort of conversion can be specified using explicit type casts (including conversions that are unsafe).

Note:

C++ pointers to members, with the exception of pointers to static members, are different from normal pointers and do not have the same standard conversions. Pointers to static members are normal pointers and have the same conversions as normal pointers. (See “Pointers to Class Members” in Chapter 2, on page 55 for more information.)