Chapter Twelve. Digging into the Visual C++ Compiler

FOR A LITTLE while, I’m going to abandon compiler agnosticism and dig into some details of Microsoft’s Visual C++ compiler. Actually, the opening discussion on destructors applies to C++ in general, and the layout of a COM object is part of the Win32 application binary interface, so it is applicable to all compilers and languages that support COM, not just Microsoft’s Visual C++ compiler. But as we dig deeper, we get into details that are more and more compiler specific.

Do you know when your destructors run?

DESTRUCTORS ARE A magical part of C++. They are not invoked explicitly under normal circumstances; instead, the compiler inserts calls to the destructor at appropriate points in program ...

Get The Old New Thing: Practical Development Throughout the Evolution of Windows now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.