C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Public inheritance with banned conversion to base

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 26 Jan 2025 09:48:54 -0800
On Sunday 26 January 2025 09:37:12 Pacific Standard Time Arthur O'Dwyer wrote:
> Then, let (1) be the scenario where the STL vendor changes the mangling of
> `std::vector` without changing its behavior (e.g. by adding or removing a
> nested `inline namespace`).

This doesn't happen. In theory it could, but in practice it won't because it's
gratuitous breaking for absolutely no gain. Therefore, there's no actual
motivation for the proposal at hand.

> Let (2) be the scenario where the STL vendor changes the behavior of
> `std::vector` without changing its mangling (e.g. by replacing
> pointer+length with pointer+pointer, or vice versa).

In this case, the Standard Library vendor is telling the world, "you must
rebuild, period". They usually will break something the ABI to indicate that
this must happen. On the ELF world, you have:
* the mangling of the the C++ namespace
* the mangling of the __attribute__((abi)) marker
* the ELF symbol versions
* the ELF SONAME / library name

Some of those exist on other OSes too, but at least one of them does. Standard
Library vendors not being stupid people will use the tools at their disposal
to indicate incompatible code and that you MUST rebuild.

And having rebuilt, the scenarios don't apply any more.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2025-01-26 17:48:57