To catch the difference between assigning and comparing.
If you mean:
if (ptr == foo)
but type
if (ptr = foo)
if will still be valid code, since ptr = foo
will evaluate to a boolean check on ptr
after it has been set to the value of foo
. Obviously, you don't want this.
However, I find it hurts readability considerably, and given that most IDE's and preprocessors will catch this anyway, never use this style.