/top/
/new/
/best/
/ask/
/show/
/job/
^
slacker news
login
about
←back to thread
Matt Godbolt sold me on Rust by showing me C++
(www.collabora.com)
611 points
LorenDB
| 1 comments |
06 May 25 17:51 UTC
|
HN request time: 0s
|
source
Show context
codedokode
◴[
06 May 25 19:45 UTC
]
No.
43908897
[source]
▶
>>43907820 (OP)
#
What about catching integer overflow? Free open-source languages still cannot do it unlike they commercial competitors like Swift?
replies(5):
>>43908922
#
>>43909326
#
>>43909444
#
>>43910683
#
>>43912986
#
kelnos
◴[
06 May 25 20:44 UTC
]
No.
43909444
[source]
▶
>>43908897
#
Rust does have checked arithmetic operations (that return Result), but you have to explicitly opt in to them, of course, and they're not as ergonomic to use as regular arithmetic.
replies(2):
>>43909660
#
>>43913722
#
1.
trealira
◴[
06 May 25 21:09 UTC
]
No.
43909660
[source]
▶
>>43909444
#
But, by default, normal arithmetic operations trap on overflow in debug mode, although they wrap with optimizations on.
ID:
GO
↑