/vd (Disable Construction Displacements)
| Overview | How Do I | Compiler Options
These options apply only to C++ code that uses virtual bases:
Command Line | Project Settings | Description |
/vd0 | Disable Construction Displacements (check box selected) | Suppresses the vtordisp constructor/destructor displacement member. Choose this option only if you are certain that all class constructors and destructors call virtual functions virtually. |
/vd1 | (Check box cleared) | Enables the creation of hidden vtordisp constructor/destructor displacement members. This choice is the default. |
To find this option in the development environment, click Settings on the Project menu. Then click the C/C++ tab, and click C++ Language in the Category box.
Visual C++ implements C++ construction displacement support in situations where virtual inheritance is used. Construction displacements solve the problem created when a virtual function, declared in a virtual base and overridden in a derived class, is called from a constructor during construction of a further derived class.
The problem is that the virtual function may be passed an incorrect this pointer as a result of discrepancies between the displacements to the virtual bases of a class and the displacements to its derived classes. The solution provides a single construction displacement adjustment, called a vtordisp field, for each virtual base of a class.
By default, vtordisp fields are introduced whenever the code defines user-defined constructors and destructors and also overrides virtual functions of virtual bases.
These options affect entire source files. Use #pragma vtordisp to suppress and then reenable vtordisp fields on a class-by-class basis.