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.