C++ v-table: Part of the language or compiler dependent?

后端 未结 2 706
你的背包
你的背包 2020-12-06 12:01

Is the v-table (virtual method table) a part of the C++ specification, or is it up to the compiler to solve the virtual method lookups?

In case it\'s part of the spe

2条回答
  •  执笔经年
    2020-12-06 12:50

    No, it's not part of the language specification. The standard specifies how calls to virtual functions must be resolved but not the mechanism that compiler implements to achieve the required results.

    It's difficult to provide a "negative" reference (i.e. to where the standard doesn't mandate a v-table) but the relevant parts of the standard for virtual function calls are 5.2.2 [expr.call] and 10.3 [class.virtual].

提交回复
热议问题