Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Woah... Correct me if m wrong... But if u have jst set the value to be null... Why would u use the if condition altogether.....???
-
@Electrux for some reason i refuse to believe that you get work done in c++ without an ide
-
@RazorSh4rk how do u say that? And ur kinda right... M truely madly deeply in love with visual c++... Jst makes the work so much more easier with autoformatting and stuff 😁
-
@Corb that is old code stink. It looks like the if clause was added later, or copy pasted from somewhere else, using an outdated IDE that does not use lint warnings. Or it was a clueless dev from last week...
-
@Electrux the way I've seen it explained elsewhere is that it future proofs the code.
If someone comes along a year from now and changes the way the address list gets initialised, the list could potentially be null or could potentially have value, so checking for nullness will protect the app exploding due to an NPE if someone negligent comes along and changes the code without checking where that variable gets used.
Granted, the two are right next to each other, so it's a lot less relevant here... But that's why IDEs highlight it as bad practice.
Good old Java, eh? -
zironite28y@theactionslacks But NPEs are pretty much solved by options/optionals and they do it much better...
-
Honestly, if that's the worst thing in your code base, it's doing pretty well.
The horrors I've seen ...
Related Rants
"So, how bad is the current code base?"
undefined
java