Questions: https://github.com/regehr/assert_quiz/blob/master/assert_quiz.md
- bad, should handle error sensibly
- bad, debug builds don't even alloc
- bad, should handle error sensibly
- ?, assert ok, but code around clearly bad: the hash_function has no idea what lenght is, and no modulo done after
- bad, should handle error sensibly
- kinda ok. You probably want a way to turn off expensive assertions, though. This way you can run prog with all asserts on small tests, and with cheap asserts on big tests (an with no asserts in release -- if you so fancy).
- bad, release build skips otherCode if 42
- bad, should handle error sensibly
- ok, but lack of {} is somewhat error prone. (Yes, I do it all the time.)
- bad, that's not even an assertion. assert(true)? come on
- blah, see tweets
- bad, should be a static assert
- bad, check your geometry
- bad, side effect
- ok, especially in hyperbolic geometries. euclid would probably request a stronger assert
- bad, side effect
that said, "handling errors sensibly" turns out to be very annoying, especially without exceptions