swift函数的调用约定

 

  • The convention of the function, indicated by the

     

    attribute. This is similar to the language-level @convention attribute, though SIL extends the set of supported conventions with additional distinctions not exposed at the language level:

      • @convention(thin) indicates a "thin" function reference, which uses the Swift calling convention with no special "self" or "context" parameters.
      • @convention(thick) indicates a "thick" function reference, which uses the Swift calling convention and carries a reference-counted context object used to represent captures or other state required by the function. This attribute is implied by @callee_owned or @callee_guaranteed.
      • @convention(block) indicates an Objective-C compatible block reference. The function value is represented as a reference to the block object, which is an id-compatible Objective-C object that embeds its invocation function within the object. The invocation function uses the C calling convention.
      • @convention(c) indicates a C function reference. The function value carries no context and uses the C calling convention.
      • @convention(objc_method) indicates an Objective-C method implementation. The function uses the C calling convention, with the SIL-level self parameter (by SIL convention mapped to the final formal parameter) mapped to the self and _cmd arguments of the implementation.
      • @convention(method) indicates a Swift instance method implementation. The function uses the Swift calling convention, using the special self parameter.
      • @convention(witness_method) indicates a Swift protocol method implementation. The function's polymorphic convention is emitted in such a way as to guarantee that it is polymorphic across all possible implementors of the protocol.

 

https://github.com/apple/swift/blob/master/docs/SIL.rst#properties-of-types

 

转载于:https://www.cnblogs.com/feng9exe/p/10601967.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值