What does a compiled C++ class look like?

后端 未结 6 1251
醉话见心
醉话见心 2020-12-14 03:34

With some background in assemble instructions and C programs, I can visualize how a compiled function would look like, but it\'s funny I have never so carefully thought abou

6条回答
  •  清歌不尽
    2020-12-14 03:53

    "Compiled classes" mean "compiled methods".

    A method is an ordinary function with an extra parameter, usually put in a register (mostly %ecx I believe, this is at least true for most Windows compilers who have to produce COM objects using __thiscall convention).

    So C++ classes are not terribly different from a bunch of ordinary functions, except for name mangling and some magic in constructors/destructors for setting up vtables.

提交回复
热议问题