4 ms·
Just imagine that SQLite is written in C and the major of bugs are logical/optimization ones, not related to memory management. And when talking about C++, sin
by mister_hn 6y ago
Just imagine that SQLite is written in C and the major of bugs are logical/optimization ones, not related to memory management.
And when talking about C++, since 2011 there are smart pointers to help developers managing memory kind of automatically.
I believe most of the problems are due the people typing on those keyboards such bad code, especially when it comes to "smart" code.
In 2020 we have plenty of tools supporting the developer job (memory sanitizers, static analysis tools, linting, profilers, etc.): The big problem is failing to / ignoring to use such tools.
- saagarjha 6y agoChrome is a heavy user of such tools and has many talented engineers working on it.
- aylp 6y agoCitation needed. I never see the same level of dedication in big Google or Facebook projects as in well run smaller projects like SQLite. You are directly rewarded for "new" features (i.e. plagiarizing or rewriting old ones and selling them as new). So I don't think the engineers are particularly talented, and the incentives are not the same as for SQLite.
- ReactiveJelly 6y agoIf using Rust results in fewer bugs for less money, shouldn't we still do it? The reason SQLite can test so thoroughly is that their requirements never change. I have tried to browse the web with SQLite but so far no luck.
- alpp 6y agoIf one has to deal with boring Rust zealots all day, the answer is no.
- boccko 6y agoDo you think issue at google is not knowing about/not using the proper tools?
- aylp 6y agoNo, the issue is that the incentives are wrong (features, features, features for promotion) and indeed the engineers (on average) are not that talented.
- mister_hn 6y agoFeatures (user tracking and fancy options) over stability. Why do we see the version of Chrome reaching 100 at a sustained pace, instead of seeing something like Chrome 8.X or 9.Y? The pressure is all about introducing new features (and thus, more bugs!) while fixing the existing bugs slowly. And we should stop thinking that all the brilliant minds are working at FAANG, because it isn't true.
- _ph_ 6y agoAh, the "bad code" fallacy. If we hadn't had enough experiences already, the article we are disucssing here clearly shows, how difficult it is, to get C/C++ code reasonably error free. Yes, there exist a free applications, which are pretty good in that respect, but if your goal is to be error-free, the development time balloons. And you are often limited to very simple memory allocation schemas. If you think that "smart pointers" should be used, why not just use a memory-safe language?
- winrid 6y agoWell, smart pointers will still result in a more predictable program. Modern GCs are amazing. But it's hard to be super predictable with them.
- thePunisher 6y agoI would argue that most of the memory errors actually pertain to C programs, not C++ ones (providing they use proper encapsulation and libraries such as STL). C is syntactically C++ being a subset of C++ and I've seen many programs which claim to be C++ but are actually programmed using C methodologies.
- zetafunction 6y agoActually, sqlite has its share of memory safety issues. https://bugs.chromium.org/p/chromium/issues/list?q=Type%3DBug-Security%20status%3AFixed%20sqlite&can=1 https://bugs.chromium.org/p/chromium/issues/list?q=Type%3DBu... (and to be clear, this is just a coarse search, and the bugs there aren't necessarily all bugs in sqlite, but there are definitely some)