You're missing the extra "=" in the conditional.
It's actually true because the assignment of 517 to x worked.
But yeah, that kind of stuff would drive me nuts too, back in the day.
Me too. Someone long ago when I first started in Borland C told me something to avoid this:
if (517 = x) {
}
I got into the habit of always putting the primitive first in comparisons such as these
if ((some_var = do_something(blah)) < 10)
Thank you. I thought == was only for strings. Shows how much I have to learn.
Just to emphasize something here - if you find yourself blaming the SDK (whether XCode, Eclipse, Visual C++ etc) for some code not behaving the way you expect, it's 99.99999% certain to be a bug in your code.
(x = 517) always equates to true. ulbador's habit is a good one to get into.