C programmer’s lament

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
  • double-free
  • 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. Continue reading