2 ms·
> compiles and runs just fine. For fairly low values of those. Creating a null reference is UB, your program is not legal at all.
by masklinn 8y ago
> compiles and runs just fine.
For fairly low values of those. Creating a null reference is UB, your program is not legal at all.
- jessaustin 8y agoSure, we're not supposed to do that. Sometimes it happens anyway, and the C++ compiler isn't much help in that case.
- coldtea 8y agoIf the compiler still accepts it, then that it belongs to the "UB" class of code is not much comfort. The whole point is to NOT have it be accepted.