I found that some programmers would like to code like this in the comparator operator. I found it is more difficult to read…
if (0 == foo()){
....
}
Is there any different between foo() == 0 in term of readability ? What’s the advantage of using 0 ==foo()?
No I think the best reason to do it like this:
is to make sure you don’t forget one
=which would make itwhich will usually raise a compiler error rather than
which creates a hard-to-find bug.