Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Right, but if the compiler has proved that you don't need those null checks then you can simply remove them.

This can be the case now, but then later someone adds new code that you did need that null check.

> If you think you do need them then it's a sign you've screwed up somewhere and should fix it!

Hm, so instead of

> Wouldn't it be better to have compile errors if the compiler figures out that it can remove a null check?

you wanted the opposite: warn when a null check is there and was actually required :).

Not sure if this is a working solution either. Maybe if it was behind a macro, JUST_CHECKING_IF_NULL(x)..



Yeah sounds like the best solution is explicit checks that the compiler understands - REDUNDANT_NULL_CHECK(...), REQUIRED_NULL_CHECK(...).

I mean obviously the solution is to use a sane language but you know...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: