4 ms·
SQLite with a Fine-Toothed Comb
- advisedwang 11y agoUB = undefined behaviour for anyone else who didn't get the unspecified acronym at first glance.
- sshykes 11y agoThanks. I'm sure many of us will come here to complain about it then immediately benefit from the info you've provided! I wish authors would qualify more of their exotic initialisms in general.
- SixSigma 11y agoIt is defined at first use : Here I try to depict the various categories of undefined behaviors (UBs)
- advisedwang 11y agoHuh, I didn't see that when I first read the article. Maybe it was added or maybe I just missed it.
- thefifthsetpin 11y agoHe amended the article after getting comments like yours.
- choward 11y agoIt's not an acronym. It's an initialism unless you are actually pronouncing it "ub".
- TorKlingberg 11y agoWe need to get John Regehr on the C standard committee!
- jevinskie 11y agoI'm somewhat surprised by D. Hipp's response. I understand that the UB in SQLite is "OK" since it is very well tested, but I figured he would still have a strong opinion about avoiding almost all UB. Regehr is right though, I'm working on porting SQLite to iOS (and a CMake build system along the way) for as part of testing a custom compiler for correctness. I already got the SQLite TCL test suite running on a jailbroken device and the number of failures was less than 20, out of many tens of thousands of tests. That is definitely tractable!! Edit: Mr. Hipp is a doctor, not a professor. Thank you, FrankBooth.
- FrankBooth 11y agoHipp is not a professor.
- deleted 11y ago[deleted]
- pascal_cuoq 11y agoI'm not sure what in the article gave you the impression that Richard Hipp doesn't have a strong, positive opinion about fixing undefined behavior in SQLite. He has patiently fixed all the issues that were straightforward to fix. That's commendable. Some of the design choices in SQLite go back to the early 2000, and looked like good ideas at the time. Some of the problems detected by tis-interpreter had no sanitizer to detect them until the latter appeared. That's a long time to use seemingly okay, in-practice-harmless idioms such as 1-indexed arrays everywhere in a large software project. And there is the question of how many real bugs would be introduced by trying too hard to fix these (though hopefully the excellent test suite would prevent that).
- nkurz 11y agoYou may not have seen Richard's comment that was added at the bottom of the the blog post just before 'jevinskie' commented. It includes this paragraph: Prof. Regehr did not find problems with SQLite. He found constructs in the SQLite source code which under a strict reading of the C standards have “undefined behaviour”, which means that the compiler can generate whatever machine code it wants without it being called a compiler bug. That’s an important finding. But as it happens, no modern compilers that we know of actually interpret any of the SQLite source code in an unexpected or harmful way. We know this, because we have tested the SQLite machine code – every single instruction – using many different compilers, on many different CPU architectures and operating systems and with many different compile-time options. So there is nothing wrong with the sqlite3.so or sqlite3.dylib or winsqlite3.dll library that is happily running on your computer. Those files contain no source code, and hence no UB. I'm not sure yet if this is a appropriately healthy or inappropriately fatalistic attitude. I like that it puts the emphasis on testing the binary rather than focussing on how any particular compiler version interprets the source, but I don't know if even SQLite has dense enough tests to justify confidence in this approach. It also makes me wonder if there should be greater emphasis on binary distribution.