|
|
|
|
|
by MaxBarraclough
1903 days ago
|
|
> What happens if you overflow at runtime? A crash, I assume/hope? In Ada, if range constraints are broken at runtime, a Constraint_Error is raised (or 'thrown', if you prefer). [0] (That's assuming of course that range checks haven't been disabled, which is an option that Ada compilers offer you.) > I don't see why the default for Java is to have these really nitty-gritty numeric types At the risk of retreading our earlier discussion: I think the short answer is performance. Java has lofty goals of abstraction, yes, but it also aims to be pretty fast. If it didn't, its appeal would diminish considerably, so it's reasonable that they struck a balance like this. Same goes for why primitives aren't objects. [0] https://learn.adacore.com/courses/Ada_For_The_CPP_Java_Devel... |
|