Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What could C/C++ "lose" if they defined a standard ABI?

Tags:

c++

c

standards

abi

The title says everything. I am talking about C/C++ specifically, because both consider this as "implementation issue". I think, defining a standard interface can ease building a module system on top of it, and many other good things.
What could C/C++ "lose" if they defined a standard ABI?

like image 279
Khaled Alshaya Avatar asked Jan 17 '10 23:01

Khaled Alshaya


People also ask

Does C have a standard ABI?

C has no standard ABI in principle, but in practice, this rarely matters: You do what your OS-vendor does. Take the calling conventions on x86 Windows, for example: The Windows API uses the so-called 'standard' calling convention (stdcall). Thus, any compiler which wants to interface with the OS needs to implement it.

What is standard ABI?

A complete ABI, such as the Intel Binary Compatibility Standard (iBCS), allows a program from one operating system supporting that ABI to run without modifications on any other such system, provided that necessary shared libraries are present, and similar prerequisites are fulfilled.


1 Answers

The freedom to implement things in the most natural way on each processor.

I imagine that c in particular has conforming implementations on more different architectures than any other language. Abiding by a ABI optimized for the currently common, high-end, general-purpose CPUs would require unnatural contortions on some the odder machines out there.

like image 52
dmckee --- ex-moderator kitten Avatar answered Sep 18 '22 06:09

dmckee --- ex-moderator kitten