Live data from Hacker News

C Is Best (2025)

sqlite.org

31–40 of 574 posts

Re: C Is Best (2025)

#31
post #17

> Rust needs a mechanism to recover gracefully from OOM errors. Linus also brought this up: https://lkml.org/lkml/2021/4/14/1099

None of Rust's language features allocate; not arrays, not closures, not iterators. Everything is stack-allocated by default. Rust code doesn't malloc unless you use a library that calls malloc; in other words, exactly like C. Rust fully supports turning off the parts of the standard library that perform allocation, and this is precisely what embedded code and the Linux kernel does. So Rust already gives you full con…

Yeah, it's not ideal that the standard library currently has blind spots around allocation and I hope those get resolved eventually, but if you're rolling everything from scratch in C anyway then it's not much of a stretch to likewise roll your own Rust primitives in places where the included batteries don't work for you.

Re: C Is Best (2025)

#32
post #5

Makes a lot of sense for SQLite to be written in C. It's a heavily optimized and debugged database implementation: Just look at btree.c with all its gotos :) The only language that would make sense for a partial/progressive migration is zig, in huge part due to its compatibility with C. It's not mentioned in the article though.

Zig hasn't even had it's first release yet. And projects written in it still break in new releases. Given their stance on boringness and maturity it would make no sense for Sqlite to consider zig yet.

SQLite is never gonna be rewritten by its creators in another language. That is highly doubtful considering the age of SQLite and the roadmap for support I think until 2060 or mid 2050s based on what I’ve read.

Re: C Is Best (2025)

#33
The bit about why not OOP seems a bit old. I think we're past a point where people are going for OOP as the default shape of code.

Overall, it makes sense. C is a systems language, and a DB is a system abstraction. You shouldn't need to build a deep hierarchy of abstractions on top of C, just stick with the lego blocks you have.

If the project had started in 2016, maybe they would have gone for c++, which is a different beast from what it was pre-2011.

Similarly, you might write SQLite in Rust if you started today.

Re: C Is Best (2025)

#34
Every project and programmer shouldn't feel they have to justify their choice not to use Rust (or Zig), who seem to be strangely and disproportionately pushed on Hacker News and specific other social media platforms. This includes the pressure, though a bit less in recent years, to use OOP.

If they are getting good results with C and without OOP, and people like the product, then those from outside the project shouldn't really have any say on it. It's their project.

Re: C Is Best (2025)

#35

There's already attempted re-implementations of SQLite in Rust, so if it really is a good approach, time should tell. https://turso.tech/blog/introducing-limbo-a-complete-rewrite...

Really time will tell indeed. It’s too early.

When the Rust version has the same take-up as the C version I know and trust, I might use it. Until then I'll wait. What's available now is good. I'm in no hurry to use an alternative. I like the idea of a reliable black-box, and I don't overly care how the black-box does its magic.

Re: C Is Best (2025)

#36

*C-API is the best. As a language, it's too basic. Almost every C projects try to mimic what C++ already has.

I considered it outdated back in 1993, when all major GUI based systems (Apple, IBM, Microsoft) were going with C++ for userspace applications.

Then came the rise of FOSS adoption, with the GNU manifest asserting to use only C as compiled language.

"Using a language other than C is like using a non-standard feature: it will cause trouble for users. Even if GCC supports the other language, users may find it inconvenient to have to install the compiler for that other language in order to build your program. So please write in C."

The GNU Coding Standard in 1994, http://web.mit.edu/gnu/doc/html/standards_7.html#SEC12

Re: C Is Best (2025)

#37
> Rust needs to mature a little more, stop changing so fast, and move further toward being old and boring.

One of the very strange things about C is that it is designed by a committee that is inherently conservative and prefers to not add new features, especially if they have any chance of breaking any compatibility. This seems necessary before Rust ever becomes an old, boring language.

But I don't see Rust ever going in such a direction. It seems fundamentally opposed to Rust's philosophy, which is to find the best solution to the problems it's trying to solve, at any cost, including breaking compatibility, at least to some degree.

Re: C Is Best (2025)

#38
post #34

Every project and programmer shouldn't feel they have to justify their choice not to use Rust (or Zig), who seem to be strangely and disproportionately pushed on Hacker News and specific other social media platforms. This includes the pressure, though a bit less in recent years, to use OOP. If they are getting good results with C and without OOP, and people like the product, then those from outside the project should…

I get asked this all the time regarding TidesDB. Why didn’t you choose Rust? Well.

Yeah this super common. Great comment.

Re: C Is Best (2025)

#39
I love C and Assembly and I'm impressed by the things people can build in those languages and often (not always) I can understand the code written in it. It's also true that code written in it is available to every other language. For that I'm very happy, as I'm mostly working in higher level languages that can call things like sqlite.

Just imagine if all of Chromium was written in C and used simpler tools like GNU Make and Git for it's projects.

Re: C Is Best (2025)

#40

*C-API is the best. As a language, it's too basic. Almost every C projects try to mimic what C++ already has.

That’s not true, give me an example used in real code out in the wild?

Since I am feeling generous, here are two examples,

https://docs.gtk.org/glib/

https://github.com/antirez/sds

Post reply on HN