Specifying how the stack Is maintained

Visual C++ supports six calling conventions that you can use on a function. The __clrcall specifier means that the function should be called as a .NET function and allows you to write code that has mixed native code and managed code. C++/CLR (Microsoft's language extensions to C++ to write .NET code) is beyond the scope of this book. The other five are used to indicate how parameters are passed to a function (on the stack or using CPU registers) and whose responsibility it is to maintain the stack. We will cover just three: __cdecl, __stdcall, and __thiscall.

You will rarely explicitly use __thiscall; it is the calling convention used for functions defined as members of custom types, and indicates that ...

Get Beginning C++ Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.