4 ms·
I've written a few CLI utilities in C over the past couple of years. Here's why I keep choosing it for tools that I want to distribute. C is the lowest common
by nrclark 5y ago
I've written a few CLI utilities in C over the past couple of years. Here's why I keep choosing it for tools that I want to distribute.
C is the lowest common denominator. It has good compilers that just work, with no drama or surprises. It's portable across CPUs and operating systems. It will continue to work for all Unix-like platforms long after trendier alternatives have turned to dust.
It has good code formatters and analyzers. It's an easy language to completely understand, and it's easy to read if I don't try to get to clever with macros or type tricks.
I don't have to remember whether ${language_feature} is Considered Harmful yet, like C++ or Rust where the current best practices constantly become Bad Code in favor of the next trendy feature.
The C ABI is the standard for libraries on Unix-likes, and I usually want to use a couple of special-purpose libraries. Calling libraries requires no wrappers, FFIs, or anything else.
Yes, C has limitations. Lots of them. But it also has an enduring momentum that's not going away any time soon.