C++ Logo

std-proposals

Advanced search

Re: [std-proposals] ABI

From: Hans <hguijtra_at_[hidden]>
Date: Thu, 11 Jul 2024 19:31:02 +0200
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 17:31:07