Happy About C Programmers

01 Apr 2008

I’m so happy that so many people program in C. Old and ugly as C is, I have two main reasons to like it:

  1. The C language is very portable. Since the C specification is simple, stable and (as far as I can tell) properly implemented in all compilers, you never run into compiler-specific issues with C code. Also, every operating environment on the planet has a C compiler.

  2. C code has great performance. This comes naturally from the fact that C is a relatively low-level language (and to a certain extent that C programmers tend to be speed freaks).

For this reason, I like to use library code written in C (and there’s a lot of C libraries out there). Also, I like the fact that I can download the source for a C project and be quite sure that it will compile and run. But I wouldn’t want to program in C. The language is complicated and tedious, so it takes a lot of care to write code that works and is safe. If I want speed-critical code, I’d write it in C++. (News flash for the ignorant: C and C++ are two different languages. There is no such thing as “C/C++”.) The performance of C++ code is more or less the same as for C, but C++ is a more expressive language. (Another news flash: You do not have to do object oriented programming in C++ if you don’t want to, as it supports procedural programming as well.) The problem with C++ is related to bullet #1 above. C++ is far from as portable as C. Different compilers implement the standard differently, and there are lots of subtle differences and bugs in the compilers. Also, there is normally no guarantee that binary code from different compilers will work with each other.

So I enjoy the portability of C, but I wouldn’t like to write in C myself. I’m just glad that there are lots of C programmers out there.

On the web side, the same goes for PHP. I don’t know much about PHP, but what I’ve seen has been ugly. But there are lots of good products written in PHP that I can use, and there are plenty of hosts that support PHP, so I’m glad that there are PHP programmers too.

blog comments powered by Disqus