Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Bound checks are usually conditionally compiled. That's more a kind of "contract" you'll verify during testing. In the end the software actually used will not check anything.

    #ifdef CONTRACTS
    if (i >= array_length) panic("index out of bounds")
    #endif


an hygienic way to handle that is often "assert", can be a macro or a built in statement.The main problem with assertions is the side-effects. The verification must be pure...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: