News for hackers. Stuff that matters.
Re:The Compiler Is Your Best Friend, Stop Lying to It by Lvl999Noob on Thursday January 01, 2026 @04:18AM (#46452559)
You don't. Assertions are assumptions. You don't explicitly write recovery paths for individual assumptions being wrong. Even if you wanted to, you probably wouldn't have a sensible recovery in the general case (what will you do when the enum that had 3 options suddenly comes in with a value 1000?).

I don't think any C programmer (where assert() is just debug_assert!() and there is no assert!()) is writing code like:

    assert(arr_len > 5);
    if (arr_len <= 5) {
        // do something
    }
They just assume that the assertion holds and hope that some thing would crash later and provide info for debugging if it didn't.
Re:The Compiler Is Your Best Friend, Stop Lying to It by addaon on Thursday January 01, 2026 @01:20PM (#46456540)
Anyone writing with a standard that requires 100% decision-point coverage will either not write that code (because NDEBUG is insane and assert should have useful semantics), or will have to both write and test that code.