[swift-evolution] Splat

Jordan Rose jordan_rose at apple.com
Wed Feb 10 16:35:49 CST 2016


> On Feb 10, 2016, at 14:32, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> However, I’d be reticent to start using ! for safe operations like dereferencing a (guaranteed memory safe) pointer.
> 
> A pointer dereference can cause a segfault. Even if you assume it's not pointing to unallocated memory, UnsafePointers can be nil, at least in Swift 2.

Aside: I'm still hoping to make this Optionality explicit at some point, so that 'UnsafePointer' is known non-null and 'Optional<UnsafePointer>' may be null. But even then you can't be sure the memory hasn't been freed since you first got the pointer.

Jordan


More information about the swift-evolution mailing list