← Back to context

Comment by astrange

3 days ago

Is full ABI compatibility important? I'm having a hard time seeing why.

I mean… C isn't even an unsafe language. It's just that C implementations and ABIs are unsafe. Some fat pointers, less insanely unsafe varargs implementations, UBSan on by default, MTE… soon you're doing pretty well! (Exceptions apply.)

How would you integrate C3 with other programming languages (not just C), or even talk to operating systems if you don't implement a common ABI?

And the various system ABIs supported by C compilers are the defacto standards for that (contrary to popular belief there is no such thing as a "C ABI" - those ABIs are commonly defined by OS and CPU vendors, C compilers need to implement those ABIs just like any other compiler toolchain if they want to talk to operating system interfaces or call into libraries compiled with different compilers from different languages).

  • > How would you integrate C3 with other programming languages (not just C)

    That's the job of an FFI. The internal ABI of most languages isn't anything like their FFI, eg any garbage collected language can't use the OS "C" ABI.

    Most operating systems don't use the same ABI for kernel syscalls and userland libraries either. (Darwin is an exception where you do have to link a library instead of making syscalls yourself.)

    > contrary to popular belief there is no such thing as a "C ABI"

    It is a "C ABI" if it has eg null-terminated strings and varargs with no way to do bounds checking.