3 ms·
The C++ code though, compiles, runs and doesn't segfault. That way of obtaining a null reference is actually quite portable. Where you going to run aground is
by kazinator 2y ago
The C++ code though, compiles, runs and doesn't segfault.
That way of obtaining a null reference is actually quite portable.
Where you going to run aground is when you have some null reference in some scope, and you have some code conditional on it being null. Yet the optimizing compiler assumes that since a reference is being checked for having a null address that comparison is always false.