• 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: Avoiding == and = mixup in if statements
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Avoiding == and = mixup in if statements


  • Subject: Re: Avoiding == and = mixup in if statements
  • From: Chris <email@hidden>
  • Date: Fri, 21 May 2004 12:26:03 -0400

Or change your coding style so that your compares are done like this:

if( nil == myObject )

Then if you make a mistake and type if( nil = myObject ) you'll get an error.

Chris

On Friday, May 21, 2004, at 09:11AM, Randall Meadows <email@hidden> wrote:

>At 10:10 AM +0800 5/21/04, Christoffer Lerno wrote:
>
>>Java disallows stuff like
>>
>>if (myObject=nil) { dosomething }
>>
>>Is it possible to maybe disallow the same potential error when I'm
>>writing obj-c programs? Could I do something with the pre-processor
>>perhaps?
>
>Use the -Wparentheses compiler flag (which is also enabled when you
>use -Wall). (Read the man page for gcc to find out why this works.)
>
>
>randy
>_______________________________________________
>cocoa-dev mailing list | email@hidden
>Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Avoiding == and = mixup in if statements
      • From: Steve Bird <email@hidden>
  • Prev by Date: Utility Panel and Child Windows
  • Next by Date: [ANN] BioCocoa 1.5
  • Previous by thread: Re: Avoiding == and = mixup in if statements
  • Next by thread: Re: Avoiding == and = mixup in if statements
  • Index(es):
    • Date
    • Thread