▲ 258 ▼ I mean it could be right (i.imgur.com) submitted 2 years ago by genfood@feddit.de to c/programmer_humor@programming.dev 19 comments fedilink hide all child comments
[–] TootSweet@lemmy.world 1 point 2 years ago (1 child) TIL! I wonder how many languages out there do define what happens on integer overflow. permalink fedilink source parent hideshow 2 child comments replies: [–] BatmanAoD@programming.dev 1 point 2 years ago Languages with dynamic typing and implicit large-integer types, such as Python and Ruby, generally just convert to that large-integer type. I figured Java would probably define the behavior in the JVM, but based on a quick web search it sounds like it probably doesn't by default, but does provide library methods to add or subtract safely. Rust guarantees a panic by default, but provides library methods for wrapping, saturating, and unchecked (i.e. unsafely opting back in to undefined behavior). permalink fedilink source parent
[–] BatmanAoD@programming.dev 1 point 2 years ago Languages with dynamic typing and implicit large-integer types, such as Python and Ruby, generally just convert to that large-integer type. I figured Java would probably define the behavior in the JVM, but based on a quick web search it sounds like it probably doesn't by default, but does provide library methods to add or subtract safely. Rust guarantees a panic by default, but provides library methods for wrapping, saturating, and unchecked (i.e. unsafely opting back in to undefined behavior). permalink fedilink source parent