lundi 1 juin 2015

Does order of compared literals matter if both are evaluated? [duplicate]

This question already has an answer here:

I have a rather stupid question. The point is, I often see an if statement looking like this:

private int smth;
// ...
if (3 == smth)
    // ...

The order feels odd for me. I even think it decreases readability of the code.

Is there any profit from putting literals that are compared to each other with binary operator in certain order within an if statement?

Aucun commentaire:

Enregistrer un commentaire