|
1 | 1 | ---
|
2 | 2 | description: "Learn more about: /vmm, /vms, /vmv (General Purpose Representation)"
|
3 |
| -title: "/vmm, -vms, -vmv (General Purpose Representation)" |
4 |
| -ms.date: "11/04/2016" |
| 3 | +title: "/vmm, /vms, /vmv (General Purpose Representation)" |
| 4 | +ms.date: 04/12/2021 |
5 | 5 | f1_keywords: ["/vms", "/vmm", "/vmv"]
|
6 | 6 | helpviewer_keywords: ["Virtual Inheritance compiler option", "general purpose representation compiler options", "vms compiler option [C++]", "vmm compiler option [C++]", "/vmm compiler option [C++]", "-vmm compiler option [C++]", "-vms compiler option [C++]", "/vms compiler option [C++]", "vmv compiler option [C++]", "/vmv compiler option [C++]", "Single Inheritance compiler option", "-vmv compiler option [C++]"]
|
7 |
| -ms.assetid: 0fcd7ae0-3031-4c62-a2a8-e154c8685dae |
8 | 7 | ---
|
9 |
| -# /vmm, /vms, /vmv (General Purpose Representation) |
| 8 | +# `/vmm`, `/vms`, `/vmv` (General Purpose Representation) |
10 | 9 |
|
11 |
| -Used when [/vmb, /vmg (Representation Method)](vmb-vmg-representation-method.md) is selected as the [representation method](vmb-vmg-representation-method.md). These options indicate the inheritance model of the not-yet-encountered class definition. |
| 10 | +Used when [`/vmg`](vmb-vmg-representation-method.md) is selected as the [representation method](vmb-vmg-representation-method.md). These options indicate the inheritance model of the not-yet-encountered class definition. |
12 | 11 |
|
13 | 12 | ## Syntax
|
14 | 13 |
|
15 |
| -``` |
16 |
| -/vmm |
17 |
| -/vms |
18 |
| -/vmv |
19 |
| -``` |
| 14 | +> **`/vmm`**\ |
| 15 | +> **`/vms`**\ |
| 16 | +> **`/vmv`** |
20 | 17 |
|
21 |
| -## Remarks |
| 18 | +### Options |
| 19 | + |
| 20 | +**`/vmm`**\ |
| 21 | +Specifies the most general representation of a pointer to a member of a class as one that uses multiple inheritance. |
| 22 | + |
| 23 | +The corresponding [inheritance keyword](../../cpp/inheritance-keywords.md) and argument to [`#pragma pointers_to_members`](../../preprocessor/pointers-to-members.md) is **`multiple_inheritance`**. |
| 24 | + |
| 25 | +This representation is larger than the one required for single inheritance. |
| 26 | + |
| 27 | +If you use **`/vmm`** and declare a pointer to member of a class that has a virtual inheritance model, the compiler generates an error. |
| 28 | + |
| 29 | +**`/vms`**\ |
| 30 | +Specifies the most general representation of a pointer to a member of a class as one that uses either no inheritance or single inheritance.The corresponding [inheritance keyword](../../cpp/inheritance-keywords.md) and argument to [`#pragma pointers_to_members`](../../preprocessor/pointers-to-members.md) is **`single_inheritance`**. |
22 | 31 |
|
23 |
| -The options are described in the following table. |
| 32 | +This option generates the smallest possible representation of a pointer to a member of a class. |
| 33 | + |
| 34 | +If you use **`/vms`** and declare a pointer to member of a class that has a multiple or virtual inheritance model, the compiler generates an error. |
| 35 | + |
| 36 | +**`/vmv`**\ |
| 37 | +Specifies the most general representation of a pointer to a member of a class as one that uses virtual inheritance. This pointer representation never causes an error and is the default. |
| 38 | + |
| 39 | +The corresponding [inheritance keyword](../../cpp/inheritance-keywords.md) and argument to [`#pragma pointers_to_members`](../../preprocessor/pointers-to-members.md) is **`virtual_inheritance`**. |
| 40 | + |
| 41 | +This option requires a larger pointer and more code to interpret the pointer than the other options. |
| 42 | + |
| 43 | +## Remarks |
24 | 44 |
|
25 |
| -|Option|Description| |
26 |
| -|------------|-----------------| |
27 |
| -|**/vmm**|Specifies the most general representation of a pointer to a member of a class to be one that uses multiple inheritance.<br /><br /> The corresponding [inheritance keyword](../../cpp/inheritance-keywords.md) and argument to [#pragma pointers_to_members](../../preprocessor/pointers-to-members.md) is **multiple_inheritance**.<br /><br /> This representation is larger than that required for single inheritance.<br /><br /> If the inheritance model of a class definition for which a pointer to a member is declared is virtual, the compiler generates an error.| |
28 |
| -|**/vms**|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.<br /><br /> The corresponding [inheritance keyword](../../cpp/inheritance-keywords.md) and argument to [#pragma pointers_to_members](../../preprocessor/pointers-to-members.md) is **single_inheritance**.<br /><br /> This is the smallest possible representation of a pointer to a member of a class.<br /><br /> 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.| |
29 |
| -|**/vmv**|Specifies the most general representation of a pointer to a member of a class to be one that uses virtual inheritance. It never causes an error and is the default.<br /><br /> The corresponding [inheritance keyword](../../cpp/inheritance-keywords.md) and argument to [#pragma pointers_to_members](../../preprocessor/pointers-to-members.md) is **virtual_inheritance**.<br /><br /> This option requires a larger pointer and additional code to interpret the pointer than the other options.| |
| 45 | +In Visual Studio 2019 and earlier versions, Microsoft uses different representations (of different sizes) for pointer-to-member types. Pointers to members of classes that have no inheritance or single inheritance have the smallest representation. Pointers to members of classes that have multiple inheritance are larger. Pointers to members of classes that have virtual inheritance are the largest. When no representation model is specified to the compiler, it defaults to using the largest, most general representation. |
30 | 46 |
|
31 |
| -When you specify one of these inheritance-model options, that model is used for all pointers to class members, 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 compiling with **/vms**; however, if you want to use the most general case (at the expense of the largest data representation), compile with **/vmv**. |
| 47 | +When you specify one of these inheritance-model options, that model gets used for all pointers to class members, no matter their inheritance type or whether you declare the pointer before or after the class. If you always use single-inheritance classes, you can reduce code size by compiling with **`/vms`**. However, if you want to use the most general case (at the expense of the largest data representation), compile with **`/vmv`**. |
32 | 48 |
|
33 | 49 | ### To set this compiler option in the Visual Studio development environment
|
34 | 50 |
|
35 | 51 | 1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
|
36 | 52 |
|
37 |
| -1. Click the **C/C++** folder. |
| 53 | +1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page. |
38 | 54 |
|
39 |
| -1. Click the **Command Line** property page. |
| 55 | +1. Enter the compiler option in the **Additional Options** box. |
40 | 56 |
|
41 |
| -1. Type the compiler option in the **Additional Options** box. |
42 | 57 |
|
43 | 58 | ### To set this compiler option programmatically
|
44 | 59 |
|
45 | 60 | - See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalOptions%2A>.
|
46 | 61 |
|
47 | 62 | ## See also
|
48 | 63 |
|
49 |
| -[/vmb, /vmg (Representation Method)](vmb-vmg-representation-method.md)<br/> |
50 |
| -[MSVC Compiler Options](compiler-options.md)<br/> |
51 |
| -[MSVC Compiler Command-Line Syntax](compiler-command-line-syntax.md) |
| 64 | +[`/vmb`, `/vmg` (Representation method)](vmb-vmg-representation-method.md)<br/> |
| 65 | +[MSVC compiler options](compiler-options.md)<br/> |
| 66 | +[MSVC compiler command-line syntax](compiler-command-line-syntax.md) |
0 commit comments