C Is Best (2025)

SQLite’s use of C and project goals

  • Thread notes the actual page title is “Why Is SQLite Coded in C?”, not “C Is Best”; the article is more nuanced than the submission title.
  • Commenters agree C suits SQLite’s goals: extreme portability (including exotic and embedded targets), tiny dependency footprint, and a C API that any language can call.
  • SQLite’s enormous proprietary test suite (far more LOC than the code itself) and 100% machine‑branch coverage requirement shape language choice; extra runtime checks from “safe” languages would introduce untestable branches.
  • SQLite is explicitly engineered to recover from out‑of‑memory (OOM) rather than abort, which current mainstream “safe” ecosystems don’t support cleanly.

C: simplicity, stability, and sharp edges

  • Pro‑C arguments: small core language, predictable performance, ubiquitous compilers and tooling, stable ABI on common platforms, and suitability for embedded systems.
  • Critics point to undefined behavior, tricky syntax (declarations, lexer hacks), integer promotions, and pervasive memory‑safety hazards that typical projects don’t fully mitigate.
  • Some argue that in disciplined hands C can handle OOM and race conditions; others counter that decades of CVEs show this doesn’t scale, likening C to a “hazardous material” that requires extreme process and tooling.

Rust, OOM handling, and “safety”

  • The article’s Rust section is seen as somewhat dated, but its core concerns still resonate: rapid language evolution, ecosystem immaturity for some domains, and poor support for graceful OOM handling.
  • Long sub‑thread debates Rust’s default “panic on allocation failure” vs C‑style explicit error handling and Zig‑style “allocation can fail, free must not.”
  • There’s disagreement whether most real systems can meaningfully recover from OOM; some report successful designs using backpressure and preallocated buffers, others say overcommit and complexity make this rare.
  • Rust’s unsafe and C interop are acknowledged as necessary for low‑level work; a recent kernel bug in Rust glue code is used both to argue “Rust isn’t magic” and “it still reduces the unsafe surface compared to C.”

Rewrites and Rust SQLite clones

  • Most participants think the original SQLite will never be rewritten by its maintainers; the cost and risk would outweigh benefits given its maturity and testing.
  • Instead, independent Rust rewrites (e.g., Turso / Limbo) are cited as experiments: they may eventually prove out Rust’s advantages or remain niche alternatives.
  • Some users say they’ll only consider such rewrites once they match SQLite’s stability, feature set, and adoption.

OOP, paradigms, and language fashion

  • The article’s “why not OOP” section is viewed as dated; several note that on HN and in systems circles, classic OOP (especially inheritance‑heavy designs) has been out of favor for years.
  • Encapsulation is seen as the only widely appreciated OOP idea; many advocate functions over methods, minimal mutation, and separation of IO from logic.
  • Functional and data‑oriented styles (including in Rust, C, and Lisps) are presented as easier to reason about, for humans and increasingly for AI tools.

ABI, FFI, and other language candidates

  • C’s de facto role as lingua franca is heavily emphasized: every serious platform can call C; many non‑C libraries expose C shims for this reason.
  • It’s noted that Rust, Zig, C++, etc. can also expose C ABIs, but their native ABIs are unstable or compiler‑specific.
  • A few suggest Ada/SPARK as a better “safe, boring systems” candidate matching SQLite’s stated criteria (safety, certification, embedded suitability), though this remains theoretical within the thread.

Meta: hype, evangelism, and tool choice

  • Several comments push back against “rewrite it in Rust” advocacy aimed at successful C projects; others defend strong Rust evangelism as a reaction to C/C++’s long safety problems.
  • There’s broad agreement that project maintainers owe their users a clear rationale for language choices—but not acquiescence to external pressure. SQLite is held up as an example of a project doing this transparently.