function declaration with throw
- void f() throw() // no exceptions allowed 不允许抛出任何异常
void f() throw(...) // all exceptions allowed 允许抛出任何异常
void f() throw(type) // only the exception of type type allowed 只允许抛出type类型的异常
void f() throw(...) // all exceptions allowed 允许抛出任何异常
void f() throw(type) // only the exception of type type allowed 只允许抛出type类型的异常
do {
class Holder {
var closure:(Void->Void)?
deinit {
print("\(self.dynamicType) \(#function)")
}
}
{
let h = Holder()
h.closure = {
[weak h] in // weak
guard let h = h else { return } // here comes the weak–strong dance
print(h) // strong
}
}()
}
}
循环引用是两个对象实例作为彼此的属性成员互相持有导致的。
对于在实例的方法中对其他实例进行持有(引用计数加一)是不会造成循环引用的,因为当方法执行完毕后,其局部变量自动摧毁时,对其引用对象的引用计数自动减一。
闭包的循环引用是因为闭包的镜像表(相当于闭包对象实例的成员)持有了闭包拥有者实例,而其拥有者又持有了闭包实例,即如上所述,两个对象实例作为彼此的属性成员互相持有造成了循环引用。所以在镜像表中做弱引用或无主引用声明后(如实例代码注释weak的部分),再在闭包内做强弱转换(示例代码注释weak-strong dance部分),这相当于在闭包镜象实例的方法中持有其他对象,于是就避免了闭包循环引用。
__if_exists allows you to check a class have member or not. __if_exists用于检查类中是否存在某成员
__if_exists(class::member)
通过阅读官方手册进行学习是自我提高的捷径。
MSDN的一般结构为:
super topic
\
+ topic - Overview -+- About
| |
| +- Using
| |
| +- Reference
+--- relation topics
每个主题都有一个Overview,以摘要形式简单介绍主题的相关内容。
每个主题都包含: 关于about 用法using 参考reference 三部分。
以GDI文档为例:https://msdn.microsoft.com/en-us/library/vs/alm/dd145071.aspx.aspx)
... > Archive > Graphics > Windows GDI
-------------------------------------------+-----------------------------------
|Multiple Display Monitors is ....
... |
v Multiple Display Monitors |
v About Multiple Display Monitors |
The Virtual Screen |
... |
> Using Multiple Display Monitors |
> Multiple Display Monitors Reference |
|
顶部为其父主题,左侧为此主题的章节部分。右侧为此主题的概述。
lib staticlibrary.lib /List
lib staticlibrary /EXTRACT:membername
objdump -S membername.obj > membername.asm