C++ Logo

std-proposals

Advanced search

Re: [std-proposals] ABI

From: Tiago Freire <tmiguelf_at_[hidden]>
Date: Thu, 11 Jul 2024 19:27:05 +0000
> It solves the problem that classes, once added to the standard library, immediately fossilize, and are no longer eligible for any kind of optimisation or evolution that would change their ABI.

I just recompile my code, why would that be a problem? I change ABI on my personal libraries all the time, never had a problem.
It's a rhetorical question, that is not your real-world problem. Your problem is something else, I want to get to that.



-----Original Message-----
From: Hans <hguijtra_at_[hidden]>
Sent: Thursday, July 11, 2024 19:31
To: Tiago Freire <tmiguelf_at_hotmail.com>; std-proposals_at_lists.isocpp.org
Subject: Re: [std-proposals] ABI

On 11/07/2024 18:19, Tiago Freire wrote:
> My question here is,
> What concrete problem would this be solving?
>
> Because I don't think it solves the problem you think it solves.

It solves the problem that classes, once added to the standard library, immediately fossilize, and are no longer eligible for any kind of optimisation or evolution that would change their ABI.

It does this by clearly advertising that treating a class as stable while it is not stable is a mistake, and by providing tools that enforce stability rules.

If the proposal is accepted, classes that are newly added to the standard will be open for on-going optimisation and evolution. Existing classes will not be because of backward compatibility reasons, but those can be replaced by newer versions (std::regex2, std2::regex, something like that), and the new versions will be newly added and therefore open to improvement.

Of course there is still the potential for abuse in that existing mechanisms for creating shared libraries won't disappear, but stability (or lack thereof) will be clearly advertised instead of just blindly assumed out of a general lack of guidance. Moreover, in situations where the compiler can identify that a public interface is being created using the old methods, a warning can still be emitted if an unstable class is used.

As a bonus, we get better interoperability with other languages, and potentially better optimisation.


Hans Guijt


Received on 2024-07-11 19:27:07