• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: get rid of warning "suggest parenthesis around assignment used as truth value"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: "Clark S. Cox III" <email@hidden>
  • Date: Thu, 20 Nov 2008 07:18:52 -0800

The fact that I used '=' conveys that I meant to use '=' :)

But seriously, I can't think of a single instance (outside of school) that I've read (or written) code in which someone wrote '=' when they meant '=='.

It seems like such an obvious mistake that, even if/when it does happen, it would be caught almost immediately by running the code or via a unit test.

Sent from my iPhone

On Nov 19, 2008, at 19:37, Jim Correia <email@hidden> wrote:

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:

Is there any way to make this warning not appear? Besides turning of all warnings? Xcode's own template class code generates these warnings. I mean "thanks but no thanks" for the suggestion, xcode.

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

Jim
_______________________________________________
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
_______________________________________________
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


  • Follow-Ups:
    • Re: get rid of warning "suggest parenthesis around assignment used as truth value"
      • From: Jim Correia <email@hidden>
    • Re: get rid of warning "suggest parenthesis around assignment used as truth value"
      • From: Scott Ribe <email@hidden>
References: 
 >get rid of warning "suggest parenthesis around assignment used as truth value" (From: Bob Sabiston <email@hidden>)
 >Re: get rid of warning "suggest parenthesis around assignment used as truth value" (From: Sherm Pendley <email@hidden>)
 >Re: get rid of warning "suggest parenthesis around assignment used as truth value" (From: Bob Sabiston <email@hidden>)
 >Re: get rid of warning "suggest parenthesis around assignment used as truth value" (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: get rid of warning "suggest parenthesis around assignment used as truth value"
  • Next by Date: Re: get rid of warning "suggest parenthesis around assignment used as truth value"
  • Previous by thread: Re: get rid of warning "suggest parenthesis around assignment used as truth value"
  • Next by thread: Re: get rid of warning "suggest parenthesis around assignment used as truth value"
  • Index(es):
    • Date
    • Thread