| ▲ | dccsillag 2 days ago | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I'm sorry, but what exactly is the problem with the code? I've been staring at it for quite a while now and still don't see what is counterintuitive about it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | dataflow a day ago | parent | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Depends on where you're coming from, but some people would expect it to enforce that the pointer is non-null, then proceed. Which would actually give you a guaranteed crash in case it is null. But that's not what it does in C++, and I could see it not being entirely obvious. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | IshKebab 2 days ago | parent | prev [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There's nothing wrong with it. It does exactly what you think it does when passed null. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||