What could C/C++ “lose” if they defined a standard ABI?

后端 未结 8 1945
清酒与你
清酒与你 2020-12-01 07:41

The title says everything. I am talking about C/C++ specifically, because both consider this as \"implementation issue\". I think, defining a standard interface can ease bui

8条回答
  •  长情又很酷
    2020-12-01 08:39

    Basically, everyone missed that one of the C++14 proposals actually DID define a standard ABI. It was a standard ABI specifically for libraries that used a subset of C++. You define specific sections of "ABI" code (like a namespace) and it's required to conform to the subset.

    Not only that, it was written by THE Herb Stutter, C++ expert and author the "Exceptional C++" book series.

    The proposal goes into many reasons why a portable ABI is difficult, as well as novel solutions.

    https://isocpp.org/blog/2014/05/n4028

    http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4028.pdf

    Note that he defines a "target platform" to be a combination of CPU architecture (x64, x86, ARM, etc), OS, and bitness (32/64).

    So the goal here, is actually having C++ code (Visual Studio) be able to talk to other C++ code (GCC, older Visual Studio, etc) on the same platform. It's not a goal of a universal ABI that lets cellphones libraries run on your Windows machine.

    This proposal was NOT ratified in C++14, however, it was moved into the "Evolution" phase of C++17 for further discussion/iteration.

    https://www.ibm.com/developerworks/community/blogs/5894415f-be62-4bc0-81c5-3956e82276f3/entry/c_14_is_ratified_the_view_from_the_june_2014_c_standard_meeting?lang=en

    So as of January 2017, my fingers remain crossed.

提交回复
热议问题