3 ms·
Panic=abort is more like -fno-exceptions since it applies to all the code being compiled and not just function. Codegen can also take advantage of the fact that
by singron 2y ago
Panic=abort is more like -fno-exceptions since it applies to all the code being compiled and not just function. Codegen can also take advantage of the fact that it won't have to unwind.
I don't think there is a rust equivalent of noexcept.
- weinzierl 2y agoDoes C++ std::terminate unwind the stack and call destructors? Then noexcept would be pretty close to regular Rust panics, wouldn't it? Basically an unrecoverable exception?
- favorited 2y agoThe behavior of `-fno-exceptions` isn't standardized, because it's a compiler feature, not a part of the C++ standard. The standard says: > In the situation where no matching [exception] handler is found, it is implementation-defined whether or not the stack is unwound before std::terminate is invoked. In the situation where the search for a handler encounters the outermost block of a function with a non-throwing exception specification, it is implementation-defined whether the stack is unwound, unwound partially, or not unwound at all before the function std::terminate is invoked. So, the whole thing is basically implementation-defined (including `-fno-exceptions`, since that is something that implementing compilers provide).
- g15jv2dp 2y ago> Does C++ std::terminate unwind the stack and call destructors? No, it doesn't. Try this: https://godbolt.org/z/cvG17cYEs https://godbolt.org/z/cvG17cYEs