Re: returning nil on initialization
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.