C++ Logo

sg10

Advanced search

Re: [SG10] Adding a macro to identify the ABI

From: Ed Smith-Rowland <3dw4rd_at_[hidden]>
Date: Sat, 07 Jan 2017 15:32:17 -0500
On 01/06/2017 08:45 PM, Saleem Abdulrasool wrote:
> Hi,
>
> I was wondering if it would be possible to add a macro to identify the
> underlying ABI that the C++ runtime is using? Although itanium is the
> more popular choice, there are alternative ABIs such as the one which
> Microsoft uses. I would propose something like the following:
>
> __cpp_abi_itanium
> __cpp_abi_microsoft
>
> They would be defined to 1 based on which is being used. This would
> allow the implementation to change the behavior based on the ABI being
> used.
>
> Thanks!
>
> --
> Saleem Abdulrasool
> compnerd (at) compnerd (dot) org
>
>
> _______________________________________________
> Features mailing list
> Features_at_[hidden]
> http://www.open-std.org/mailman/listinfo/features

This is an interesting idea. ABI is not really a language problem so
the idea might not catch here. ^H...^H. Actually, every time a language
feature is added the ABIs have to add it.

On the other hand portability ideas have been floated before and were
found illuminating (There was a paper about standardizing an ABI and..
Hinnant? Can't remember.)

One thing that pops into my mind is that even within one ABI we have to
change it periodically. I'm thinking mostly library here. But even
language ABI you might want to date rather than just 1 or 0. The
library ABI would depend on library vendor more than chip vendor.

Jason Merrill knows a lot about this I think.

Ed

__cpp_abi_itanium yyyymm

...

__cpp_lib_abi_gnu yyyymm

__cpp_lib_abi_msvc yyyymm


I know both language and library ABI would change with compiler switches.

In libstdc++ we can switch between a CoW string/list O(n)-size to a
C++11 string/O(1) list size world.

I'm interested in this.

Ed



Received on 2017-01-07 22:32:46