|
|
|
|
|
by msbarnett
3410 days ago
|
|
> The compiler deduction is that the null test is redundant, but it's not actually redundant. No. The compiler is forced to assume x isn't null, because int y = *x; has no meaning iff x IS null, so the compiler can't possibly generate any code to cover that case. There's no definition of that construct for the compiler to work off of that could possibly allow x to be null. Blame the standard if you want, but you can't blame the compiler for not generating code to cover behaviour that you've made up in your head. |
|