다음을 통해 공유


/vmm, /vms, /vmv   (General Purpose Representation)

OverviewHow Do ICompiler Options

If you select General-Purpose Always (/vmg) as the representation method, you must also specify an option to indicate the inheritance model of the not-yet-encountered class definition. You can select one of the following three options.

Command Line Project Settings Description
/vmm Point to Single- and Multiple-Inheritance Classes
  • Specifies the most general representation of a pointer to a member of a class to be one that uses multiple inheritance.

  • This representation is larger than that required for single inheritance.

  • If the inheritance model of a class definition for which a pointer to a member is declared is virtual, the compiler generates an error.

  • The corresponding argument to #pragma pointers_to_members is multiple_inheritance.
/vms Point to Single-Inheritance Classes
  • Specifies the most general representation of a pointer to a member of a class to be one that uses either no inheritance or single inheritance.

  • This is the smallest possible representation of a pointer to a member of a class.

  • If the inheritance model of a class definition for which a pointer to a member is declared is multiple or virtual, the compiler generates an error.

  • The corresponding argument to #pragma pointers_to_members is single_inheritance.
/vmv Point to Any Class
  • Specifies the most general representation of a pointer to a member of a class to be one that uses virtual inheritance.

  • This option requires a larger pointer and additional code to interpret the pointer than the other options.

  • It never causes an error and is the default.

  • The corresponding argument to #pragma pointers_to_members is virtual_inheritance.

On the command line, use any of these options with /vmg.

To find these options in the development environment, click Settings on the Project menu. Then click the C/C++ tab, and click C++ Language in the Category box. When you click an option under Representation Method, the General Purpose Representation list box will be enabled.

When you specify one of these inheritance-model options, that model is used for all pointers to member classes, regardless of their inheritance type or whether the pointer is declared before or after the class.

Therefore, if you always use single-inheritance classes, you can reduce code size by selecting Point To Single-Inheritance Classes from the General Purpose Representation drop-down list box; however, if you want to compile using the most general case (at the expense of the largest data representation), you can select Point To Any Class, which allows pointers to classes of all inheritance types. Point To Any Class is the default.