Re: get rid of warning "suggest parenthesis around assignment used as truth value"
Re: get rid of warning "suggest parenthesis around assignment used as truth value"
- Subject: Re: get rid of warning "suggest parenthesis around assignment used as truth value"
- From: Alexander von Below <email@hidden>
- Date: Thu, 20 Nov 2008 09:47:46 +0100
Am 20.11.2008 um 04:37 schrieb Jim Correia:
On Nov 19, 2008, at 8:14 PM, Bob Sabiston wrote:
On Nov 19, 2008, at 7:07 PM, Sherm Pendley wrote:
On Nov 19, 2008, at 7:26 PM, Bob Sabiston wrote:
Follow the suggestion given in the warning itself, and add another
set of parenthesis:
if ((foo = 1)) { ... }
Um, that's just what I *don't* want to do, unless it's the only
way. It's a small thing but that is just so unnecessary - and ugly
IMHO.
How do you convey to the next person to read the code [1] that you
intended to do an assignment in the conditional rather than a
boolean test?
[1] Which may be you several weeks from now
Yes. I think it is a good thing that Xcode warns about this issue by
default (now), and using the double parenthesis is the proper way to
handle this.
It tells both the compiler and anyone reading the code that you really
did mean an assignment
Alex
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden