Re: Swift 2 throws from init()
Re: Swift 2 throws from init()
- Subject: Re: Swift 2 throws from init()
- From: Quincey Morris <email@hidden>
- Date: Thu, 02 Jul 2015 01:05:42 +0000
On Jul 1, 2015, at 17:50 , Rick Mann <email@hidden> wrote:
>
> I didn't think it was possible to not return. Maybe an assert() is better in this situation, because I think it always indicates a programming mistake.
Indeed it is possible. There are three possible functions:
fatalError (“message”)
preconditionFailure (“message”)
precondition (booleanCondition, “message”)
I’m not sure what the difference is between the first two, but I’ve noticed that ‘fatalError’ crashes with an illegal instruction — deliberately, I assume.
‘assert’ isn’t a good choice, because it doesn’t do anything in a Release configuration build. That’s where it’s actually more important for it to crash.
_______________________________________________
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