This article is more than 1 year old
C: Everyone's favourite programming language isn't a programming language
'It has completely distorted the way we speak to each other,' says Swift and Rust boffin
Aria Beingessner, a member of the teams that implemented both Rust and Swift, has an interesting take on some of those (and other) language's problems – that C isn't a programming language anymore.
There are many problems with the C language. To pick just a few: it can be difficult to parse; there are competing and subtly incompatible variants; and then there are the complex ways C defines and handles integers and other variables.
For instance, after much deliberation, a bunch of companies called the Aspen Group settled on a programming model for 64-bit Unix and Unix-like OSes called LP64, also known as "4/8/8". Unfortunately, 64-bit Microsoft Windows uses a different model, called LLP64 or "4/4/8".
And that's before the issues around
intmax_t, which the C99 standard defines as "a signed integer type capable of representing any value of any signed integer type." As software engineer JeanHeyd Meneide pointed out, this gets complicated.
In fact, it's fair (if wildly controversial) to say, as this 2018 Association for Computing Machinery paper puts it, that C is not a low-level programming language. As its subtitle says: "Your computer is not a fast PDP-11."
This is not a relative assessment: that is, it's not saying that there are other programming languages that are lower-level than C. It's an absolute one: C is often praised for being "close to the metal," for being a "portable assembly language."
It was, once, but it hasn't been since the 1970s; the underlying computational models of modern computers are nothing like the one that C represents, which was designed for a 1970s 16-bit minicomputer.
- Nvidia: Better parallelism coming to standard C++ lib
- Oracle releases Java JDK 18 with enhanced source code documentation
- US is best place to be a software engineer, salary survey finds
- What does Go-written malware look like? Here's a sample under the microscope
The argument goes something like this: for almost any program to do anything useful or interesting, it has to run on an operating system. That means it has to interface with that OS – and so many OSes are written in C. Therefore, the language has to interface with C code, which means it has to call C APIs.
In other words, even if you never write any code in C, you have to handle C variables, match C data structures and layouts, link to C functions by name with their symbols. This applies not only to talking from any language to the OS, but calling from one language into another.
C is not just a programming language, it's also an Interface Definition Language or IDL. IDLs are very important – as we quoted back in 1999, "the CORBA Interface Definition Language IDL is… 'one of the most significant contributions in the history of computer science'."
The real problem is that C was never designed or intended to be an IDL, and it isn't very good at it.
We can't beat Beingessner's description, though: "My problem is that C was elevated to a role of prestige and power, its reign so absolute and eternal that it has completely distorted the way we speak to each other.
"Rust and Swift cannot simply speak their native and comfortable tongues – they must instead wrap themselves in a grotesque simulacra of C's skin and make their flesh undulate in the same ways it does." ®