Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
This code produces the "Mixed-type subtraction is deprecated." warning even though both `tv_usec` calls return a `_darwin_suseconds_t` aka `_int32_t` aka `Int32`
var bootTime: timeval = timeval()
var now: timeval = timeval()
_ = now.tv_usec - bootTime.tv_usec // Doesn't warn
_ = max(0, now.tv_usec - bootTime.tv_usec) // Doesn't warn
_ = UInt64(max(0, now.tv_usec - bootTime.tv_usec)) // Warns
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
For some reason it's using the Strideable conformance.
func - <T: Strideable>(lhs: T, rhs: T) -> T.Stride
I guess the 0 is providing enough context to suggest an Int return? :-(
Keith, you can work around this by using 0 as Int32.
0 as Int32
Yeah... Tricky to understand, but correct behavior. Should be worked around for now, until the deprecated overload is not removed in Swift 4.
No branches or pull requests