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

According to http://stackoverflow.com/questions/6793262/why-dereferencing... dereferencing a null pointer is undefined behaviour. Thus the example in the unit test where this occurs is IMHO a serious bug.


Note that in this case, what's actually happening is a null reference is being created; while this is very ugly (C++ references should never be null), if the reference isn't used, as the author asserts, a null dereference never happens (otherwise, there would almost inevitably be a crash). Behind the scenes it's just a NULL pointer being passed to the function that apparently ignores it.


But either way, the code is not well-formed. A null reference should never exist in a well-formed program.

http://stackoverflow.com/questions/4364536/c-null-reference




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

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

Search: