Posts

Pros/Cons for still studying C in 2025

Primer

“Why would anyone still learn C in 2025 and beyond?” - The discussion came up w/ a friend of mine, and while talking about some of the reasons I found myself surprised at the still very solid rationale for this (far stronger than anticipated).

Small disclaimer: obviously, this is outside the realm of job requirements one might encounter. If your company uses, for example, Perl & Fortran, that likely is enough reason to study those languages, disregarding general practicality.

Pros (strongest to weakest)

  • C is extremely flexible, in line with the adage: once you know what you’re doing, you want control in a language above all else (from build system, macros, memory access, understanding compiler output of non-optimized code, etc)

  • C is portable, from embedded microcontrollers to desktops to large scale compute clusters, partly because it’s a simple language to implement compilers for

Side note: many newer languages, sometimes spouting impressive features, begin their life being transpiled to C for these very reasons: a) C is so ubiquitous that transpiling to it unlocks a large set of target platforms, and b) is flexible enough that you can make it do anything!

  • C has a history of decades of high-quality teaching material from operating systems, to implementing compilers, parsers of all sorts, tooling, networking, microcontrollers, … this concerns books, reference implementations, university courses (some of which are freely accessible via YouTube or other platforms), accompanying libraries, and more

  • C lends itself well to having many common computer science problems (data structures, algorithms) expressed in it, great for learning and study, and exposing the details, such as performance needs, of such problems

  • C still has extremely strong footing in important niches

    • Linux/BSD: native language to interact with the kernel (any distro comes w/ compiler, syscall and stdlib documentation), language for many standard Unix tools
    • embedded: microcontrollers, IoT devices, TV set-top boxes, refrigerators, automotive industry, …
    • HPC (high performance computing): used on supercomputers w/ Intel and AMD even providing their own purpose-built compilers. It is also often at the back end of many high-performance data-crunching routines people may call from Python, Julia and co (either because the libraries are local C libraries, or the Python code interacts with a compute cluster to begin w/)
  • C is timeless, it’s been around 50 years, it’ll be around for another few decades, and many of its concepts are at the very core of programming

  • C has 1st-tier interoperability w/ almost any language. Partly due to the aforementioned ease of implementing compilers for it. A library written in C you may use from Go, Odin, Zig, Python, Julia,… and this use case is often well documented & supported (though mileage varies of course on a per-language and use case basis)

  • C is a raw and relatively small language (compared to C++ & Rust especially), with simple and strongly idiomatic code, that a mere mortal can hope to grasp. Now you can argue about UB and things like implicit conversions, the lack of namespaces and the questionable C preprocessor, but C code by and large looks and feels similar across many codebases. C can be learned far quicker than many other languages occupying the systems programming space; many languages are considered C-like, a lot of C’s code style is part of many other language’s syntax

Cons (strongest to weakest)

  • C’s overall build system and lack of module system make it an extremely painful experience to set up and manage projects, especially for smaller projects or for learning purposes the setup may be a burden quickly weighing one down
    • no module system, inclusion system is text-based (difficult to understand and debug, things like include order, given macros, may even matter; macros in turn aren’t type checked properly etc)
    • nuisance to set up and manage with archaic and/or complicated build systems (make/CMake)
    • lack of namespaces leads to conflicts
    • including other C projects can become extremely difficult
      • you might have to compile them using an unknown build tool (they may suddenly use Ninja, or vcpkg/conan, or custom build shell scripts, or…)
      • it’ll be cumbersome integrating building the dependency automatically given this
      • the dependency may have further dependencies itself
    • it will be difficult to share your code
      • creating a static executable (certain system libraries will not be set up for static linking) is extremely difficult
      • having a “shippable” installer, executable or reliable instructions to compile from source given different distributions, library versions, OSs is a painful task

^ strongly associated w/ this is the legitimate question of “how do I get someone else to run my code?” A great joy of learning is to share, show off & collaborate! In JavaScript you can host your code and send someone a URL, in Go you send a developer friend a static executable, in C… you face a burdensome task every single time this comes up!

  • C is a small language, but it has a lot of undefined behavior and dangerous implicit behavior, partly allowing for extreme hacks (often cool, though difficult to manage responsibly), has many footguns, is difficult to debug (partly because of its dangerous yet powerful preprocessor) and a C project often involves multiple languages at once: C, preprocessor, build tool, potential package tool, potential shell scripts, ergo: “small language” != “easily learnable to use effectively”

  • C’s standard library is extremely lacking in data structures, algorithms, and abstractions, making it not fun to use it to learn overall computer science concepts. Languages w/ much more batteries included provide a far better basis for a general exploration of computer science topics by and large; compare to Odin as a batteries included language, which natively has proper arrays, utf-8 encoded strings, slices, simple to use structure of arrays, matrices, array programming, a context system to use your own allocators, …

  • C being low-level is partly a myth; it’s raw and powerful, true, but low-level implies mapping well to hardware, and one could argue even assembly doesn’t map well unto modern hardware anymore! To do any sorts of efficient computing on multi-core architectures involves a lot of pain points and additional abstractions (like using OpenMP or similar); natively concurrent/parallel languages probably provide better abstractions for mapping logic unto actual hardware execution, examples may be Chapel, Go, Elixir, Fortran (surprisingly, given it has native parallel-executable for loops and coarrays), which may more effectively map to modern data processing

  • C code often being idiomatic is a questionable adage: complex code bases often involve a lot of hacks to provide various needed abstractions which are lacking in the language, going so far as to sometimes even implement their own OOP-constructs crudely

Pros

Cons

Conclusion

The reasons vary, and the mileage varies based on interest and partly inclinations and even personality I’d say; it’s not a waste of time, but the pros and cons which came up are interesting enough to share. Make of them what you will

← Back to Posts