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

You need to look at the text of the Standard itself when it comes to this level of language lawyering. The short answer is that operator[] has undefined behavior if the index is out of range. Performing a check and terminating the program with some kind of runtime error is a legal subset of "undefined behavior", and so it's commonly done in debug builds, but you cannot rely on it in any sense.


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

Search: