News for hackers. Stuff that matters.
Re:The Use of assert() in SQLite by kalecserk on Friday April 26, 2019 @09:10PM (#19763101)
> In SQLite, the presence of assert(X) means that the developers have a proof that X is always true.

Almost impossible to prove anything in a sufficiently complex system such as SQLite. The difference between assert and always seems arbitrary IMHO

Re:The Use of assert() in SQLite by viraptor on Friday April 26, 2019 @10:37PM (#19763418)
You're only using it locally for specific invariants. That doesn't have to depend on the system's complexity. For example assert(2+2==4) works the same, regardless of it's only a one line app, or in the middle of an OS kernel.
Re:The Use of assert() in SQLite by saagarjha on Friday April 26, 2019 @09:28PM (#19763171)
The difference is that assert has been “proved” to be true, while ALWAYS is merely thought to be true.
Re:The Use of assert() in SQLite by chris_wot on Friday April 26, 2019 @09:56PM (#19763291)
I’m still uncertain what they mean by “prove” though.
Re:The Use of assert() in SQLite by hcs on Friday April 26, 2019 @11:45PM (#19763641)
Probably the same mechanism by which most proofs work, not fully formal but it seems to follow. Without the proofs in comments (or transitively through other asserts) it's up to the reader to recreate the argument, though. The purpose is to be more explicit than a comment, I suspect, using the same notation as the code.
Re:The Use of assert() in SQLite by kevingadd on Friday April 26, 2019 @10:31PM (#19763402)
sqlite has extremely thorough test coverage with something approaching 100% branch coverage and such wide production usage it's basically proven that a lot of this stuff works.
Re:The Use of assert() in SQLite by nn3 on Friday April 26, 2019 @11:34PM (#19763604)
Most (all?) of the production usage probably doesn't enable the assert though.