C++ Logo

std-proposals

Advanced search

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

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Tue, 20 Dec 2022 19:33:12 +0100
Il 20/12/22 18:51, Edward Catmur ha scritto:
> 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.

Sure -- but I was not advocating specifically for [[trivial_abi]]; I was
using it as an example of a _proven_ performance improvement that a
different ABI can bring, and yet, it's behind an opt-in (rather than
just going ahead and breaking ABI).

This was in the context of the fact that adding a relocation constructor
to something like unique_ptr would instead automatically be ABI breaking
unless there's an opt-out, and I was wondering if that was a good idea.

My 2 c,
-- 
Giuseppe D'Angelo

Received on 2022-12-20 18:33:16