[swift-users] Checking if an UnsafeMutablePointer is NULL in Swift 3

Dmitri Gribenko gribozavr at gmail.com
Tue Jul 5 18:30:47 CDT 2016

On Tue, Jul 5, 2016 at 3:40 PM, Vinicius Vendramini via swift-users
<swift-users at swift.org> wrote:
> Hi all!
> Used to be in Swift 2.x I only had to compare an unsafe pointer (obtained from a C API) to nil to know whether or not it was NULL. After conversion to Swift 3, it seems that isn’t allowed anymore.
> I remember watching something about it in WWDC but I can’t remember (or find) the solution anymore. Can someone point me in the right direction?

UnsafePointer<T> is not nullable anymore.  'UnsafePointer<T>?' is
nullable, like any optional.


(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the swift-users mailing list