I'm doing a C++ compiler project where I need to flag warnings at places where assignment operator can be used wrongly instead of the comparison operator. .e.g
while doing comparison in if statement , to check variable a as 10 sometimes we wrongly type if(a= 10), which will result in if statement always true whereas I wanted to be true only if a is 10. Some of the cases I can think of are :
if(var = a), logically it should beif( var==a )while(var = a )for(;var=a;)do{}while(var=a)var=a? "some XYZ": "some ABC"
Can you please help me with the more cases where this logical error can occur, where the user was supposed to use == and by mistake = was used?