4 ms·
One point I didn't see mentioned that asserts can be used by the compiler to enable certain optimisations. For instance, if you assert that an incoming index i
by sagacity 2y ago
One point I didn't see mentioned that asserts can be used by the compiler to enable certain optimisations.
For instance, if you assert that an incoming index into a function is within the bounds of a vector, then during the rest of the function the compiler can elide any bounds checking.