[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSString initWithUTF8String:...
From: |
Adam Fedor |
Subject: |
Re: NSString initWithUTF8String:... |
Date: |
Sun, 11 Feb 2001 13:57:03 -0700 |
Richard Frith-Macdonald wrote:
>
> On Sunday, February 11, 2001, at 03:28 PM, Manuel Guesdon wrote:
>
> > NSString initWithUTF8String: fail with NULL parameter
> > What does OpenStep/NextStep/MacOSX for this case ? Does it consider it's a
> > zero length
> > string, does it raise an exception
> > or does it crash in strlen,... calls ?
> >
> > I think we should at least raise an exception in this case (?)
>
> I don't know what MacOS does, but my preference is for tolerance ... it
> should treat it
> as a zero length string (and perhaps log a warning if compiled for debug -
> it's what NSDebugMLog() is for).
I agree. By convention, init methods should never cause an exception.
They should either tolerate the input, or at worst, return nil (and emit
a NSLog message) if the input somehow could corrupt the object.