2 ms·
> I believe that could be trivially fixed by giving functions proper names that indicate what they do or what they are intended for. For example, calling such a
by masklinn 8y ago
> I believe that could be trivially fixed by giving functions proper names that indicate what they do or what they are intended for. For example, calling such an optimised-away assertion function `debug_only_assert()` would immediately rule out such unintentional misuse.
That is Rust's tack:
> [assert!] assertions are always checked in both debug and release builds, and cannot be disabled.
> Unlike assert!, debug_assert! statements are only enabled in non optimized builds by default. An optimized build will omit all debug_assert! statements unless -C debug-assertions is passed to the compiler.