Any half-worthy compiler produces the same code (if == and! = Were overloaded, as mentioned elsewhere), so optimization issues are not important.
I don’t think I have ever seen "if (! (A == b))" beyond the larger conditional condition, when it is clearer not to use DeMorgan’s theorem, but I suppose I could see it as a way of emphasizing that these two values really need to be identical, and there is something deeply wrong if they are not. However, the breakthrough of the big "OmgICantBelieveThisHappenedException ()" throw on the next line will be even more clear .:-)
Apart from these two situations, I have to agree with the camp "use! =", As it is more clear when you look at the code. "!" can be easily overlooked, especially with some formatting conventions.
source share