Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Warning flag for 'if (x = y)'



On 16 Jan 2004, at 19:42, Prachi Gauriar wrote:

In Xcode, if I set that flag for the build style, I get no warnings, but when I set it on a particular file, I do. Is this expected behavior? I would think you could set it for the whole project, but it doesn't quite work.


That might suggest why people's suggestions to use -Wparentheses hasn't worked for me.


While others have pointed out useful warning options, I'd like to point out a useful coding idiom: Whenever possible, use an r-value on the left side. e.g., all of the following will generate complaints from the compiler, whereas the reverse ordering won't:

This wouldn't have helped in my case, since both sides were just ints, not constants.

Matt
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Warning flag for 'if (x = y)' (From: Matt Gough <email@hidden>)
 >Re: Warning flag for 'if (x = y)' (From: Alastair Houghton <email@hidden>)
 >Re: Warning flag for 'if (x = y)' (From: Prachi Gauriar <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.