This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: suggest parentheses around assignment used as truth value


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]