Skip to content

Design note: ABI

Herb Sutter edited this page Oct 5, 2022 · 6 revisions

Q: Is Cpp2 ABI-breaking, ABI-preserving, or ABI-neutral?

A: Neutral, and presents an opportunity.

ABI is an orthogonal issue. ABI is up to the platform vendor.

However, Cpp2 presents an opportunity because Cpp2 code inherently (and by design) gives us a "bubble of new code" that doesn't exist today, with the opportunity to make that code mean what we want it to mean without worrying about breaking changes... and that means we can make link-level ABI changes as well as source-level language changes.

For example, it would be easy to have Cpp2 functions use a specific platform-supported ABI without worrying about breaking link compatibility with any existing code. A simple example would be if cppfront were someday to emit all Cpp2 free functions on Windows as __stdcall-but-with-left-to-right-arguments-and-small-structs-in-registers-as-bjarne-the-creator-intended or whatever made sense.