C Icon

C

C is a general purpose programming language that first appeared in 1972.
8 Stories
All Topics

The Overflow Icon The Overflow

Comparing Go vs C in embedded applications

On our episode with Brian Kernighan, I asked him if there were ever a situation in which he would advise you start a new program in C today. His response:

I think probably unless you are in one of these resource-constrained environments, clearly, right upfront, that you’re going to be resource-constrained and the improvement of hardware isn’t gonna rescue you in the next couple of years, I would not start with C. I really wouldn’t. And then it depends what is your application.

As if on queue, StackOverflow blogger Marcin Pasinski has done a comparison between C and Go in the quintessential resource-constrained environment. Oddly enough, no mention of TinyGo in the piece, but otherwise a solid analysis.

Aria Beingessner gankra.github.io

C isn't a programming language anymore

This piece by Aria Beingessner is incredibly relevant to our shipping-this-week episode with Brian Kernighen:

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.

C is the lingua franca of programming. We must all speak C, and therefore C is not just a programming language anymore – it’s a protocol that every general-purpose programming language needs to speak.

And just in case these pull quotes leave you with the impression that Aria is happy about the situation… yeah, nope.

Microsoft github.com

A modern app engine with a nostalgic feel

dos-like is a programming library/framework, kind of like a tiny game engine, for writing games and programs with a similar feel to MS-DOS productions from the early 90s.

Rather than writing code that would run on a real DOS machine, dos-like is about making programs which run on modern platforms like Windows, Mac and Linux, but which attempts to recreate the look, feel, and sound of old DOS programs.

A modern app engine with a nostalgic feel

C sqlite.org

Richard Hipp's single file webserver written in C

Althttpd is a simple webserver that has run the sqlite.org website since 2004. Althttpd strives for simplicity, security, and low resource usage.

As of 2018, the althttpd instance for sqlite.org answers about 500,000 HTTP requests per day (about 5 or 6 per second) delivering about 50GB of content per day (about 4.6 megabits/second) on a $40/month Linode. The load average on this machine normally stays around 0.1 or 0.2. About 19% of the HTTP requests are CGI to various Fossil source-code repositories.

Richard has a knack for creating simple, high quality tools. When we did our (now legendary) show with him back in 2016, he was quite keen on coming back at some point to discuss Fossil. Should we make that happen?

Ars Technica Icon Ars Technica

“A damn stupid thing to do" (The origins of C)

Ars Technica goes long form for this (abridged) history of the C programming language.

In one form or another, C has influenced the shape of almost every programming language developed since the 1980s. Some languages like C++, C#, and objective C are intended to be direct successors to the language, while other languages have merely adopted and adapted C’s syntax. A programmer conversant in Java, PHP, Ruby, Python or Perl will have little difficulty understanding simple C programs, and in that sense, C may be thought of almost as a lingua franca among programmers.

But C did not emerge fully formed out of thin air as some programming monolith. The story of C begins in England, with a colleague of Alan Turing and a program that played checkers.

If you have some downtime this week[end]… find a comfy spot, a hot drink, and enjoy a history lesson on one of the most influential and still extant programming languages of all times.

C github.com

tic-tac-toe in a single call to printf

This was written for The International Obfuscated C Code Contest 2020 and I have zero idea how it works, but the entirety of the program consists of one call to printf

int main() {
    while(*d) printf(fmt, arg);
}

While its primary purpose is to serve as The One True Debugger, printf also happens to be Turing complete. (See “Control-Flow Bending: On the Effectiveness of Control-Flow Integrity” where we introduced this in an actual, published, academic paper. The things you can get away with sometimes.)

We ab^H^Huse this fact to implement a the logic of tic-tac-toe entirely within this one printf call (and a call to scanf() to read user input).

The code is beautifully formatted, too.

  0:00 / 0:00