|
|
|
|
|
by anon4
4540 days ago
|
|
> The point is, you need to explicitly do evil things to get "null references". The language cannot and is not meant to protect you from yourself. No, you don't need to do evil things at all. Any C api that returns a pointer which you then need to pass to a C++ function that takes a reference is a possible source of failure if you forget to check your pointer. It can happen quite easily by mistake. The language cannot in any way guarantee that you won't make a reference from a null pointer. At least taking a reference as an argument does at least alert people that you're not expecting to be passed a null as an argument to your function. |
|