Re:Push ifs up and fors down
by LegionMammal978 on Wednesday November 15, 2023 @09:36PM
(#38285289)
Indeed, Rust's own standard library uses this method. There are lots of public-facing unsafe functions that can result in undefined behavior if called incorrectly. But if the standard library is compiled in debug mode (which currently requires the unstable flag -Zbuild-std), then it will activate assertions on many of these unsafe functions, so that they will print a message and abort the program if they detect invalid input.
[ Parent
| on HN ]