• 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: returning nil on initialization
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: returning nil on initialization


  • Subject: Re: returning nil on initialization
  • From: Daniel Waylonis <email@hidden>
  • Date: Thu, 1 Apr 2004 12:21:52 -0800

On Mar 29, 2004, at 11:36 AM, Ondra Cada wrote:

> Chaz,
>
> On Sunday, Mar 28, 2004, at 23:13 Europe/Prague, Chaz McGarvey wrote:
>
>> So my question: is returning nil if the initialize fails generally a
>> bad thing to do, design-wise if nothing else?
>
> Yup, it's completely all right and up to conventions.
>
> That, of course, does not prevent any number of programmers to ignore
> the conventions and write things like
>
> -init {
> [super init];
> [self whatever...];
> }
>
> but *that's* completely wrong, whilst the code of yours is correct.

Hi,

Speaking of which, is

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

return(self);
}

preferred to:

- (id)init
{
if ([super init])
{
...
}

return(self);
}

I'm under the impression that the result of [super init] and the
variable self will always be the same.

Thanks,
Dan
_________________________________________________
Dan Waylonis email@hidden
Software Engineer http://www.nekotech.com
nekotech SOFTWARE 650.964.2490 (O)
_______________________________________________
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: returning nil on initialization
      • From: Chris Hanson <email@hidden>
    • Re: returning nil on initialization
      • From: John Stiles <email@hidden>
    • Re: returning nil on initialization
      • From: Clark Cox <email@hidden>
  • Prev by Date: Re: scrolling mechanism question
  • Next by Date: Re: returning nil on initialization
  • Previous by thread: Best way to implement a listing view (crosspost from omni)
  • Next by thread: Re: returning nil on initialization
  • Index(es):
    • Date
    • Thread