以下 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, andInt.min
/-1
. These tests should be written explicitly in the code as comparisons if needed.
关于swift - 溢出除法运算符 '&/' 无法识别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30378591/