|
|
|
|
|
by bugake
35 days ago
|
|
You don't get Marssaxman's point: the problem is that "compiler authors treat undefined behavior as a license for user-hostile behavior". Bjarne Stroustrup's criterion for language design is that C++ is an abstraction in itself over writing in assembly, and the language design should not get in the way by introducing overhead costs. C++ should allow the programmer to express their intent without losing performance relative to assembly, and it fails in this case due to undefined behavior. So when the compiler doesn't let you implement your low-level code, it is a failure of the language and compiler relative to the design criteria of C++. |
|
There are things you simply can't write in C. I think that's okay. But even if you don't think that's okay, it doesn't conflict with zero-overhead.
-
But also, when it comes to jumping by address to a goto you didn't check is at that address, I'm on the side of the compiler here. That's not how computed goto is supposed to work. You're supposed to use an address you can know is right by reading the code.