This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: suggest parentheses around assignment used as truth value
- To: "Marc Rouaix" <rouaix at my-dejanews dot com>
- Subject: Re: suggest parentheses around assignment used as truth value
- From: Andreas Schwab <schwab at issan dot informatik dot uni-dortmund dot de>
- Date: 01 Jul 1998 11:51:23 +0200
- Cc: egcs at cygnus dot com
- References: <JMDHPDCIACOECAAA@my-dejanews.com>
"Marc Rouaix" <rouaix@my-dejanews.com> writes:
|> I'd just like to register my opiniont that code like
|>
|> if (x = p()) {...}
|>
|> shouldn't generate a warning under gcc -Wall.
What if you have a typo here?
|> Even if
|> you feel that code like this is obscure, the recommended
|>
|> if ((x = p())) {...}
|>
|> is just bizarre.
Then write it as:
x = p();
if (x) {...}
--
Andreas Schwab "And now for something
schwab@issan.informatik.uni-dortmund.de completely different"
schwab@gnu.org