C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Relocation in C++

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Tue, 20 Dec 2022 18:51:43 +0100
On Tue, 20 Dec 2022 at 11:26, Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
wrote:

> Il 20/12/22 09:56, Edward Catmur ha scritto:
> > > Also, which current potential ABI break are you referring to?
> >
> > The ideas of passing a `unique_ptr` by value in a register, just
> like a
> > raw pointer, because ... it is a raw pointer. Basically,
> > [[trivial_abi]] for it / changing the calling convention.
> >
> >
> > But that's clang-only, right? Even libc++ wants to support multiple
> > compilers.
>
> What stops other compilers from doing the same? I just pointed it out
> that that's a case where that you can have performance benefits today by
> breaking ABI (I think Google measured single-digit % improvements by
> just flipping this), and yet, it's an opt-in, not an opt-out.
>

There are a few problems with [[trivial_abi]]:

* ABI break when you add it to existing classes
* breaking compatibility if you use an old compiler or a compiler that
doesn't support it

Between these I think it would be unlikely that libstdc++ would adopt it,
and that means that g++ is likewise unlikely to implement it. I could be
wrong though.

My 2 c,
> --
> Giuseppe D'Angelo
>

Received on 2022-12-20 17:52:55