Rust's Two Kinds of 'Assert' Make for Better Code

from blog Laurence Tratt: Blog, | ↗ original
Daniel Lemire’s recent post “Daniel Lemire’s recent post “runtime asserts are not freeruntime asserts are not free” looks at the run-time cost of ” looks at the run-time cost of assertassert statements in C and shows that a simple statements in C and shows that a simple assertassert in a frequently executed loop can cause significant overhead. in a frequently executed loop can cause significant overhead. My own opinion on assertions has shifted over the years, from “I don’t see the point” to “use them sparingly” to “use them as much as possible”. That...My own opinion on assertions has shifted over the years, from “I don’t see the point” to “use them sparingly” to “use them as much as possible”. That...