From: Felipe Contreras Date: Thu, 31 Oct 2013 20:42:42 GMT Subject: Re: [PATCH 16/16] add: avoid yoda conditions Message-ID: In-Reply-To: On Thu, Oct 31, 2013 at 2:31 PM, Junio C Hamano wrote: > I agree that there is no justification to write "if 0 == something", > when "if something == 0" suffices. The latter reads better and that > is why the phrase "yoda condition" was invented. > > But the situation is different when both sides are not constants, > and especially when "<" and "<=" are involved.. To me revs.nr is virtually a constant, I'm comparing i to revs.nr, not the other way around. I believe I explained this already, but here it goes again: if (1.60 < john.size) This makes no sense, "if 1.69 is smaller than john"? The situation doesn't change when you use a variable: if (size_limit < john.size) Translates to "if size limit is smaller than john", and still makes no sense. -- Felipe Contreras