News for hackers. Stuff that matters.
Re:The Use of assert() in SQLite by crawshaw on Saturday April 27, 2019 @08:59AM (#19765281)
It won't, because of inlining and dead code removal. (At least, it didn't back around Go 1.11 when I last tested this.)
Re:The Use of assert() in SQLite by chronial on Saturday April 27, 2019 @05:09PM (#19767651)
If you do Assert(ExpensiveOp()), removing all of it is only a valid optimization if ExpensiveOp() is 100% side-effect free. But even when that is the case, the compiler won't inline ExpensiveOp() and go through the effort of proving that it's side effect free if it's sufficiently complex.
Re:The Use of assert() in SQLite by kasey_junk on Saturday April 27, 2019 @10:13AM (#19765633)
Maybe if the thing that is generating the cond at the call location is inline-able, but not if it's doing an expensive operation.

https://play.golang.org/p/Ts6QqRrWwuQ

I couldn't get that to not trigger the lock.

[later] I could get it to remove it if you pass in a func instead.

Re:The Use of assert() in SQLite by chronial on Saturday April 27, 2019 @05:10PM (#19767656)
Your Cond() has a side-effect. It can never be optimized away.
Re:The Use of assert() in SQLite by kasey_junk on Saturday April 27, 2019 @07:19PM (#19768243)
Correct. Which is one of the differences between this approach & macros. Though the lazy approach appears to work.