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.

Beingessner should know. They've previously worked on and written about both Rust and Swift.

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.

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.

This is done via Foreign Function Interfaces (FFIs). These are issues for Rust code in the Linux kernel, and The Reg has previously discussed how it affects other languages, such as Flutter and Dart and Javascript and Node.js.

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.

IDL hands...

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." ®

More about


Send us news

Other stories you might like