Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


C++ Specific

Enables the addition of the hidden vtordisp construction/destruction displacement member.

#pragma vtordisp({on | off} )


vtordisp is now deprecated and will be removed in a future release of Visual C++.

The vtordisp pragma is applicable only to code that uses virtual bases. If a derived class overrides a virtual function that it inherits from a virtual base class, and if a constructor or destructor for the derived class calls that function using a pointer to the virtual base class, the compiler may introduce additional hidden "vtordisp" fields into classes with virtual bases.

The vtordisp pragma affects the layout of classes that follow it. The /vd0 and /vd1 options specify the same behavior for complete modules. Specifying off suppresses the hidden vtordisp members. Specifying on, the default, enables them where they are necessary. Turn off vtordisp only if there is no possibility that the class's constructors and destructors call virtual functions on the object pointed to by the this pointer.

#pragma vtordisp( off )
class GetReal : virtual public { ... };
#pragma vtordisp( on )

END C++ Specific

© 2015 Microsoft