Giter Club home page Giter Club logo

Comments (6)

Chainfire avatar Chainfire commented on June 21, 2024

Its part of several checks each of which begin with this. It's a code-style-preference thing. I prefer it to be this way, redundant or not.

from libsuperuser.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 21, 2024

I don't understand.
Why would you check if something is null, if you know for a fact that it must be null?

from libsuperuser.

Chainfire avatar Chainfire commented on June 21, 2024

Because in cases like these the blocks below that check and set this variable tend to get switched around and cases added over time. Keeping the check there will prevent the logical failure that will occur when the blocks are copy/pasted to change order. There's no technical reason for this, I just prefer it this way as it prevents a possible future logic failure and is clearer to read (imho). Feel free to disagree, I feel free to not care. The compiler/optimizer will take it out anyway if it is redundant.

from libsuperuser.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 21, 2024

So you keep a check because you might move the block of code to somewhere else?
But you've already set it to be in a safe place...
For making it safer to move around, you could just put it in a function. It's one of the purposes of functions...
Another alternative is to just comment this code.
In the current situation, it just adds more code to read, so I don't get why it's more readable.
For me, removal of redundant code, as well as commented code (especially old one) makes the code more readable. The less to read, the less time it takes to read.
Plus here you made me wonder why it exists this way, so I thought maybe it's a possible bug in the code that should be taken care of...

Anyway, I will just turn off this warning for this library.
Thanks for helping out.

from libsuperuser.

Chainfire avatar Chainfire commented on June 21, 2024

Stop trying to debate preference. This is exactly why I dislike open source. I have better things to do than discussing this - it's certainly not like we're ever going to agree on it, and worse, it really doesn't matter.

from libsuperuser.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 21, 2024

OK OK.
I've already wrote : I will just turn off this warning for this project.

from libsuperuser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.