The problem is not in == vs =, it's in allowing assignment as an expression. Go fixes this, for example, by now allowing them: if a = 0 {} gives compile error.
The reason I'm asking is, because I don't know if there's ever a case where you'd want to assign right inside the if-condition. Is there?
if (Foo *foo = getFoo()) { // getFoo returns null if there is no foo
// There is a foo
}
However, this problem is basically entirely addressed by compiler warnings, which generally ask you to add an extra set of parens for this case.Edit: Actually, forget I said this. It's a dumb statement. 'if(a = true)' would always pass, regardless of the value of 'a'.