onevcat / OneV-s-Den-Comments

0 stars 0 forks source link

2015/01/swift-pointer/ #16

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Swift 中的指针使用 | OneV's Den

Apple 期望在 Swift 中指针能够尽量减少登场几率,因此在 Swift 中指针被映射为了一个泛型类型,并且还比较抽象。这在一定程度上造成了在 Swift 中指针使用的困难,特别是对那些并不熟悉指针,也没有多少指针操作经验的开发者 (包括我自己也是) 来说

https://onevcat.com/2015/01/swift-pointer/

wyboundary commented 3 years ago

deinitialize的作用应该是等同于memset(str, 0, sizeof(T))吧,不管Int这类还是类类型好像调用与否都没关系,只dellocate是必须的要用的,释放内存。