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

Other stories you might like

  • Venezuelan cardiologist charged with designing and selling ransomware
    If his surgery was as bad as his opsec, this chap has caused a lot of trouble

    The US Attorney’s Office has charged a 55-year-old cardiologist with creating and selling ransomware and profiting from revenue-share agreements with criminals who deployed his product.

    A complaint [PDF] filed on May 16th in the US District Court, Eastern District of New York, alleges that Moises Luis Zagala Gonzalez – aka “Nosophoros,” “Aesculapius” and “Nebuchadnezzar” – created a ransomware builder known as “Thanos”, and ransomware named “Jigsaw v. 2”.

    The self-taught coder and qualified cardiologist advertised the ransomware in dark corners of the web, then licensed it ransomware to crooks for either $500 or $800 a month. He also ran an affiliate network that offered the chance to run Thanos to build custom ransomware, in return for a share of profits.

    Continue reading
  • China reveals its top five sources of online fraud
    'Brushing' tops the list, as quantity of forbidden content continue to rise

    China’s Ministry of Public Security has revealed the five most prevalent types of fraud perpetrated online or by phone.

    The e-commerce scam known as “brushing” topped the list and accounted for around a third of all internet fraud activity in China. Brushing sees victims lured into making payment for goods that may not be delivered, or are only delivered after buyers are asked to perform several other online tasks that may include downloading dodgy apps and/or establishing e-commerce profiles. Victims can find themselves being asked to pay more than the original price for goods, or denied promised rebates.

    Brushing has also seen e-commerce providers send victims small items they never ordered, using profiles victims did not create or control. Dodgy vendors use that tactic to then write themselves glowing product reviews that increase their visibility on marketplace platforms.

    Continue reading
  • Oracle really does owe HPE $3b after Supreme Court snub
    Appeal petition as doomed as the Itanic chips at the heart of decade-long drama

    The US Supreme Court on Monday declined to hear Oracle's appeal to overturn a ruling ordering the IT giant to pay $3 billion in damages for violating a decades-old contract agreement.

    In June 2011, back when HPE had not yet split from HP, the biz sued Oracle for refusing to add Itanium support to its database software. HP alleged Big Red had violated a contract agreement by not doing so, though Oracle claimed it explicitly refused requests to support Intel's Itanium processors at the time.

    A lengthy legal battle ensued. Oracle was ordered to cough up $3 billion in damages in a jury trial, and appealed the decision all the way to the highest judges in America. Now, the Supreme Court has declined its petition.

    Continue reading

Biting the hand that feeds IT © 1998–2022