KanikaVarma / sudzc

Automatically exported from code.google.com/p/sudzc
0 stars 0 forks source link

Warnings on assignments in conditions #28

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. start project with Sudzc code
2. set compiler to LVVM /Clang
3. build

What is the expected output? What do you see instead?
I expect no warnings. I see warnings on assignments in "if" statement 
expressions.

What version of the product are you using? On what operating system?
XCode 4

Please provide any additional information below.

Code like 

if (self = [super init]) 
{ ...
}

used extensively in initialize methods in the Soap library generates the 
warning "Using the result of an assignment as a condition without parenthesis".

The code is efficient, but the warning is a nice thing, because accidentally 
using the assignment operator -'=' instead of the comparison operator '==' is 
such an easy mistake in C, even for experienced programmers.

Oddly, parenthesis around the expression removes the warning:

if ((self = [super init])) 
{ ...
}

Original issue reported on code.google.com by michiel....@lpsvcs.com on 27 Apr 2011 at 3:15