swift - 溢出除法运算符 '&/' 无法识别

标签 swift

以下 playground 会导致错误:

1 &/ 0 

错误:

Operator is not known binary operator
Use of unresolved identifier '&/'

Documentation说它应该返回 0

运行 xCode:版本 6.3.1 (6D1002)

有什么想法吗?

最佳答案

&/&% 在 Xcode 6.3 中被移除。

根据 release notes :

Unlike the &+, &-, and &* operators, these operators did not provide two’s-complement arithmetic behavior; they provided special case behavior for division, remainder by zero, and Int.min/-1. These tests should be written explicitly in the code as comparisons if needed.

关于swift - 溢出除法运算符 '&/' 无法识别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30378591/

相关文章:

swift - 我什么时候应该使用协议(protocol)来替换静态函数

swift - 为什么 self 在 init() 方法中被允许,即使它未通过安全检查?

ios - 使用枚举时实现 NSObject 协议(protocol)时出现链接器错误?

swift - 如何合并 String 和 Int 以获得一个 flatMap

ios - AWS Recognition 使用 IOS Swift 比较人脸

ios - 如何让我的 iOS 应用程序连续循环播放声音列表?

ios - 使用手势从 TableView 切换到另一个 Tableview

ios - 在固定宽度上使用自动布局调整 UIButton 的 titleLabel 文本

ios - Swift - 解开 UILabel.text

ios - 将视频裁剪为框架