5 ms·
In 2015 I am getting paid to write thousands of lines of extremely efficient, extremely reliable embedded software in C. From my perspective it's a great langua
by paulrpotts 11y ago
In 2015 I am getting paid to write thousands of lines of extremely efficient, extremely reliable embedded software in C. From my perspective it's a great language and I'm very, very good at it by now, having used written a lot of C since 1985 or so, when I first started to learn the language.
I do know other languages. I have used professionally, Perl, Python, Ruby, Scheme, Java, Objective-C, Lisp, Dylan, and others. I have been teaching myself Haskell in my bits of spare time for years now. I would love to be able to write some of these algorithms in my embedded work in Haskell, or an EDSL, and I think that is possible, but the fact remains that a lot of programming in the embedded space is all about managing state, and managing peripherals, which involves a lot of interrupt handlers, very low-level programming with event queues and tasks, and often a minimal OS (I'm using FreeRTOS right now) or, often, no OS at all (as in some code I've written professionally for Arduino boards and low-end Atmel microprocessors).
I am perfectly aware of C's imperfections and weak type systems, many of the safety pitfalls involved in working directly with machine words and pointers, and the relative lack of checking that most compilers do for you (compilers will often be perfectly happy to compile code that will mix signed and unsigned types in unsafe ways, or do widening or narrowing in unsafe ways, due to C's rather baroque rules for integral promotion and things like that). The partial equivalence (or, one might better say, automatic conversion under certain circumstances) between arrays and pointers is a source of endless confusion to newbies and the details of just how it works are a source of difficulty even to many experienced programmers. But after 30 years programming in C and 40 years programming altogether I can bang that shit out and make it readable and write good comments explaining what I am doing and very often my shit runs properly on the first try.
So from my perspective C is a great language. It has been the backbone of my whole career, although in truth I would love to do a lot more with Haskell.
C++ by comparison, which I've also used professionally, a lot -- does not even feel like language these days, but more some kind of endless, nightmarish research project where the best approach is to make sure you are not coming anywhere near the cutting edge.