I’ve been programming in C since I was 14 years old (1980) and I still love to code in this language. However, as much as I love C, there are certain classes of bugs that are very difficult to find, but typically have easy solutions once you do find them:
- memory corruption
- memory leak
- thread race conditions
- mutex dead-locks
Lots of younger programmers often say why don’t you write in another language with built-in garbage collection? This would resolve the first three types of bugs by making it the language’s problem to solve. My usual response is speed, portability, and “how I think“. That last one is important.
Also many of the recent languages like Java, Perl, PHP, Python, and Ruby are huge beasts; their standard class and support APIs having swelled to hundreds of classes and thousands of methods. And you still have to port and/or install the language engine to the system before your applications built on that engine becomes portable to that system. For the most part that has already been done for all the common systems in use. Still something about huge interpreted systems bothers me. For me small is beautiful and I think many programmers have lost touch with that.
I find C already portable to a large degree and any portability differences between unix like operating systems are generally well known and solved problems now. In the case of Windows, it will always be a pain in the arse, but it is for that reason I have my own portability and support library that hides much of the differences between systems. As a result, these days, I can probably code just as fast in C as most people do in a scripting language of their choice, and I’ll have a smaller, faster, more efficient program in the end.
Modern languages that support threading are still subject to dead-lock and race condition type problems, though in Java they are fewer and far between. Perl (last time I looked) and PHP do not have thread support, so they avoid these types of bugs through lack of support. Thread support for certain types of programs, like server applications, is very important especially if you want the software to be ported to Windows at a later date, since Windows has nothing like the unix fork and exec system calls.
Not to say I don’t like scripting languages. I very much like Ruby for its clean design and smaller size compared to the other choices and PHP for web sites and command line scripting is neat. Of course if you want to avoid the overhead of either of those, AWK and/or a good old Bourne shell script work well enough. Old school tools still work.
While C does provide you enough rope to hang yourself, it also allows you to create software with the intricacies and beauty of a Celtic knot.