[swift-users] Exclamation mark's in swift parameter listings?
Rien at Balancingrock.nl
Tue Jan 10 11:52:32 CST 2017
I stand corrected.
I do/did think that there is a difference in the way it handles pointers optionals and other optionals, but I now realise that even that could not be the case.
So please ignore the last line in my previous post.
The rest still stand ;-)
> On 10 Jan 2017, at 18:14, Joe Groff <jgroff at apple.com> wrote:
>> On Jan 9, 2017, at 11:19 PM, Rien via swift-users <swift-users at swift.org> wrote:
>> It means that a call to that function with an optional will unwrap the optional before it is used.
>> That is quite neat when dealing with C-API’s because often you will receive a pointer from a C-function which is optional to account for the fact that it can be NULL (= nil).
>> By using a forced unwrapped input parameter you are saved the trouble of unwrapping all these pointers when using them as input for other C-APIs.
>> In short, it makes it easier to interface with C-API’s.
>> Note that there is some under-the-hood magic going on because a C-pointer is an unboxed value, while a ‘normal’ optional is a boxed value.
> Optionals are never boxed.
More information about the swift-users