|
|
|
|
|
by nicoburns
1130 days ago
|
|
You can have it for reasons other than memory safety, for example signed integer overflow is UB in C and C++ (but not in Rust). However, higher level languages typically go to great lengths to avoid it. For example, in Java you will get a NullPointerException rather a null pointer actually being dereferenced, which immediately rules out any UB due to a pointer being dereferenced where doing so is not allowed. |
|
And I am assuming something like the NullPointerException comes with a huge performance hit? Otherwise I assume every systems language would do something similar.