• 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
Is "-init" really needed?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is "-init" really needed?


  • Subject: Is "-init" really needed?
  • From: David Hoerl <email@hidden>
  • Date: Mon, 07 Aug 2017 20:02:40 -0400

I recently saw some code where an object was alloced but there was no init:

  Foo *foo = [Foo alloc];
  foo.bar = ...

My blood pressure soared! My pulse quickened! I started breathing rapidly!

But then I though - heck, if Foo has NSObject as its super class, gee, maybe -init isn't really need. I mean, if all of Foo's ivars and properties are initialized, its a shortcut, right.

Right?

[Still trying to get pulse down...]

D
_______________________________________________

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: Is "-init" really needed?
      • From: Greg Parker <email@hidden>
    • Re: Is "-init" really needed?
      • From: Jens Alfke <email@hidden>
  • Next by Date: Re: Is "-init" really needed?
  • Next by thread: Re: Is "-init" really needed?
  • Index(es):
    • Date
    • Thread