&/ 和 &% 从 Swift 语言中删除了吗?
Were &/ and &% removed from Swift language?
&/
和 &%
是否已从 Swift 2.0 中删除或语法是否已更改?
以下内容似乎在 Swift 1.2 中有效:
var divByZero: Int8 = 100 &/ aZero
var remainderDivByZero: Int8 = 100 &% aZero
我查看了语言指南 Advanced Operations 部分,但没有看到任何关于这些操作的参考。我似乎找不到 Apple 的发行说明,其中包含从 1.2 到 2.0 的详细更改列表。
Revision history 2015-04-08 其中:
Updated for Swift 1.2.
Removed the overflow division (&/) and overflow remainder (&%) operators from Overflow Operators.
似乎一直有效,直到包括 Swift 1.1
release notes for Xcode 6.3 and Swift 1.2包括
The &/ and &% operators were removed, to simplify the language and improve consistency.
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. (17926954).
&/
和 &%
是否已从 Swift 2.0 中删除或语法是否已更改?
以下内容似乎在 Swift 1.2 中有效:
var divByZero: Int8 = 100 &/ aZero
var remainderDivByZero: Int8 = 100 &% aZero
我查看了语言指南 Advanced Operations 部分,但没有看到任何关于这些操作的参考。我似乎找不到 Apple 的发行说明,其中包含从 1.2 到 2.0 的详细更改列表。
Revision history 2015-04-08 其中:
Updated for Swift 1.2.
Removed the overflow division (&/) and overflow remainder (&%) operators from Overflow Operators.
似乎一直有效,直到包括 Swift 1.1
release notes for Xcode 6.3 and Swift 1.2包括
The &/ and &% operators were removed, to simplify the language and improve consistency. 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. (17926954).