ITPub博客

首页 > 应用开发 > > C++核心准则边译边学-I.26 不同编译器都适用的ABI使用C风格子集

C++核心准则边译边学-I.26 不同编译器都适用的ABI使用C风格子集

作者:else 时间:2019-11-22 14:29:46 0 删除 编辑

面向对象思考



I.26: If you want a cross-compiler ABI, use a C-style subset(如果想要不同编译器都能适用的ABI,使用C风格规则子集)

Reason(原因)

Different compilers implement different binary layouts for classes, exception handling, function names, and other implementation details.

不同的编译器会为类,异常处理,函数名和其他实现细节生成不同的二进制结构。

Exception(例外)

Common ABIs are emerging on some platforms freeing you from the more draconian restrictions.

在某些平台上出现的共通ABI可以将你从更加严格的限制中解放出来。

Note(注意)

If you use a single compiler, you can use full C++ in interfaces. That may require recompilation after an upgrade to a new compiler version.

如果使用单一编译器,你可以在接口中使用完全的C++。这样做可能会导致当编译器更新到新版本时,需要重新编译。

译者注:编译器的版本变化也可能影响编译结果的变化。

Enforcement(实施建议)

(Not enforceable) It is difficult to reliably identify where an interface forms part of an ABI.

(无法强制执行)很难可靠地识别哪里的接口定义会成为ABI的一部分。

译者注:ABI(Application Binary Interface):应用程序二进制接口,描述了应用程序和平台之间,或者应用的各个模块之间接口的二进制定义。

译者注:也就无法决定是否需要报警。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2318/viewspace-3143391/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-07-17

  • 博文量
    271
  • 访问量
    19558