John (Eljay) Love-Jensen wrote: > > Hi John, > >> Is there a warning option that can catch the common blunder >> if (x = y) ... >> when assignment was not intended? I can't find one in our documentation. > > Yes, use: > > gcc -Wparentheses foo.c > > HTH, > --Eljay > > Thanks, Eljay, We're using iwmmxt_le-g++ (GCC) 3.3.1 (MontaVista 3.3.1-7.0.2.0401382 2004-10-07), and the documentation does include -Wparentheses. But it doesn't produce a warning on this line if (bFoundFile = false) { which is the actual code line that prompted my question. Perhaps -Wparentheses has a different meaning in this old version. The documentation says "Warn if parentheses are omitted in certain contexts, such as when there is an assignment in a context where a truth value is expected, ..." That's all it says about assignments, then goes on to discuss "dangling else" clauses. John -- View this message in context: http://old.nabble.com/warning-on-assignment-within-conditional-tp27536657p27537980.html Sent from the gcc - Help mailing list archive at Nabble.com.