• 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: [Obj-C] if (self) vs. if (self != nil)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Obj-C] if (self) vs. if (self != nil)


  • Subject: Re: [Obj-C] if (self) vs. if (self != nil)
  • From: Graham Cox <email@hidden>
  • Date: Mon, 27 Feb 2012 12:40:20 +1100

On 27/02/2012, at 12:13 PM, William Squires wrote:

> I prefer the "if (self = [super init])" combined form, myself.


One potentially annoying thing about this form is that, if you compile with plenty of warnings on, such as the possible unintended assignment warning (if not, why not?) then this flags a warning.

Apple recommend:

self = [super init];
if( self )
{
...
}


Anyway, this seems to be one of those tiny trivial issues that people seem to get very religious about. It takes a second to type in any form, so what's the big deal?

--Graham


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: [Obj-C] if (self) vs. if (self != nil)
      • From: Jean-Daniel Dupas <email@hidden>
    • Re: [Obj-C] if (self) vs. if (self != nil)
      • From: Eeyore <email@hidden>
    • Re: [Obj-C] if (self) vs. if (self != nil)
      • From: Karl Goiser <email@hidden>
    • Re: [Obj-C] if (self) vs. if (self != nil)
      • From: William Squires <email@hidden>
References: 
 >[Obj-C] if (self) vs. if (self != nil) (From: Oleg Krupnov <email@hidden>)
 >Re: [Obj-C] if (self) vs. if (self != nil) (From: William Squires <email@hidden>)

  • Prev by Date: NSTextArea - how to change the text programmatically?
  • Next by Date: Re: [Obj-C] if (self) vs. if (self != nil)
  • Previous by thread: Re: [Obj-C] if (self) vs. if (self != nil)
  • Next by thread: Re: [Obj-C] if (self) vs. if (self != nil)
  • Index(es):
    • Date
    • Thread