Re: [swift-users] abs() Bug?

2017-12-12 Thread Greg Parker via swift-users
> On Dec 12, 2017, at 12:06 PM, C. Keith Ray via swift-users > wrote: > > Should this be reported by Radar or another mechanism? Either Radar or bugs.swift.org is fine. -- Greg Parker gpar...@apple.com Runtime Wrangler _

Re: [swift-users] abs() Bug?

2017-12-12 Thread Stephen Canon via swift-users
Please note that silently returning an incorrect value instead of crashing is the exact opposite of “safety” as understood in Swift. (These should all crash, and as others have reported, they do in my environment. If you can reproduce abs(Int32.min), please report a bug with your swift compiler

Re: [swift-users] abs() Bug?

2017-12-12 Thread Jens Persson via swift-users
They all crash when I test it with Xcode 9.2 (default toolchain and dev snapshot 2017-12-09, command line app), in what environment are you seeing the non-crashing behavior? My guess is that all of them crashing is the intended behavior, since the operations result in an overflow.. /Jens On Tue,

Re: [swift-users] abs() Bug?

2017-12-12 Thread Kelvin Ma via swift-users
this is correct behavior. −Int.min can’t be represented in signed 2’s complement because the range of Int is 2^(bitWidth - 1) ..< 2^(bitWidth - 1) so it correctly traps on SIGILL. what i’m more worried about is why abs(Int32.min) is returning a value for you,, but mine traps as it should. On Tue,

[swift-users] abs() Bug?

2017-12-12 Thread C. Keith Ray via swift-users
Should these be consistent? All crashing or none crashing? print(abs(Int8.min)) // crash print(abs(Int16.min)) // crash print(abs(Int32.min)) // prints -2147483648 print(abs(Int64.min)) // crash Should this be reported by Radar or another mechanism? I'm using this as a replacement: func sa

[swift-users] performance question

2017-12-12 Thread Седых Александр via swift-users
Hello. For example we have Class A {} Struct B {} And code 'let b = B()' will do much faster than code 'let a = A()' And therefore code 'let d = Date()' is fast, because Date is struct? And I can use it in huge cycles fearlessly? -- Alexandr Sedykh___