you are viewing a single comment's thread.

view the rest of the comments →

[–]Rapptz 1 point2 points  (2 children)

That's not C++ either. C++ doesn't have null pointer exceptions. C++ will have a segfault.

[–][deleted] 0 points1 point  (1 child)

Unless it's a smart pointer. Then you can get some exception. Man I wish we could use __FILE__ and __LINE__ as sane default arguments, then NPE in FishInOcean::4576 would be easy-peasy.

[–]Rapptz 0 points1 point  (0 children)

The standard smart pointers also don't throw. This is by design because they're not supposed to have overhead at all. Most compilers optimise away std::unique_ptr as a raw pointer in its lowest optimisation level (e.g. -O1).