3 ms·
There is no such guarantee. I fixed more than one bug of invalid references.
by JanneVee 12y ago
There is no such guarantee. I fixed more than one bug of invalid references.
- demallien 12y agoMy understanding is that it is impossible to have a NULL reference. Can you show us some code that ends up with a NULL reference? I'd be curious to see how that can be done!
- ben0x539 12y agoDereference a NULL pointer and use the result to initialize a reference. Sure, it's undefined behavior, but so are all the problems that result from NULL pointers, and in practice it doesn't crash until you "dereference" the reference by looking at the value, so it's probably as hard to track down as a NULL pointer crash.
- JanneVee 12y agoI'll leave it as an excercise to you. Promise me that I don't have to maintain your C++ code until you completed it.