3 ms·
I'd just like to clarify that it's specific _compilers_ that produce code that complies with an ABI specification (or don't). Neither the C nor the C++ language
by zabzonk 5y ago
I'd just like to clarify that it's specific _compilers_ that produce code that complies with an ABI specification (or don't). Neither the C nor the C++ language standards specify an ABI format.
- mhh__ 5y agoC++ is increasingly being covered by an ABI in all but name i.e. there are types that do have standard layouts.
- zabzonk 5y ago> there are types that do have standard layouts Out of interest (I'm not tracking the C++ standard much these days) such as? For example I know about the order of struct members and bit fields, but that has always been the case in C, and so in C++.
- mhh__ 5y agohttps://en.cppreference.com/w/cpp/types/is_standard_layout https://en.cppreference.com/w/cpp/types/is_standard_layout Bitfields are profoundly non-standard.
- steerablesafe 5y agoBitfields are standard, what are you talking about?
- mathstuf 5y agoHow they live inside of a structure is far into implementation-defined land. No ABI (afaik) says where bits live if they do not fill an octet. In practice, the compilers agree with themselves over time, but that is "code as spec" which is everyone's favorite thing for interop.
- steerablesafe 5y agoIt's well defined in the system V ABI, isn't it? Compilers do follow that. Otherwise no layout is defined by the C and C++ standards, even outside of bitfields. edit: It's under "Bit-Fields" in [1]. I'm not entirely happy with the wording, but it's there. [1] https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/x86-64-psABI-1.0.pdf#subsection.3.1.2 https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/x...
- colonwqbang 5y agoABIs are not only a quirk of each compiler, rather the ABI can be covered by its own standards document. See for instance the SysV Amd64 ABI specification. One should not have the idea that ABIs are magical or impossible to specify, if it is desired to do so.