C++ Logo

std-proposals

Advanced search

Re: [std-proposals] ABI

From: Hans <hguijtra_at_[hidden]>
Date: Thu, 18 Jul 2024 16:13:57 +0200
> So, what would your `std::stable::string` actually look like? Would it
> "do better" by using more space for the SSO buffer? Would it try to
> futureproof itself by /not/ using an SSO buffer at all?

It barely matters. All we need is agreement on what it looks like; the
precise shape is irrelevant as long as everyone uses the same one.


> Would it be guaranteed to have the same ABI on both Clang and GCC, both
> libc++ and libstdc++? Or would it still be incompatible between those two?

Yes (to the first question). That's the whole point: it is guaranteed to
have the same ABI.


> Certainly it /must/ be incompatible between libraries built with the
> Itanium ABI and libraries built with the MS ABI, because they don't even
> agree on which register to pass the `this` pointer in. Which is rather
> important, for a type with a non-trivial destructor (which needs a
> `this` pointer!).

That is only relevant if multiple ABIs coexist within a platform. Do
such platforms exist? What is the purpose of having a C++ compiler on a
platform if you can't even call into any platform libraries?

Note that I define the scope of the proposal at the beginning of the
paper. It does not include platform ABI, only class ABI. See here:

https://docs.google.com/document/d/1P1mL1J0rXJlRnLYrcquzLVqE3jPd_IC6uQYnMIE68vA/edit


> I think writing your own `hans::stable::string` would help to refine
> your ideas. Writing /forces/ you to think about considerations that
> might otherwise be handwaved or not-even-realized.

I'm not convinced that the idea you have in mind is what I have in mind,
but I do recognize that asking for an implementation is common practice.
Very well, I'll work on that.

If I demonstrate a working solution, will you at least read the paper
and not judge it solely on snippets from emails?


Hans Guijt

Received on 2024-07-18 14:13:58