News for hackers. Stuff that matters.
Re:C++'s `Noexcept` Can (Sometimes) Help (Or Hurt) Performance by singron on Monday August 05, 2024 @03:14PM (#41164434)
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.

Re:C++'s `Noexcept` Can (Sometimes) Help (Or Hurt) Performance by weinzierl on Monday August 05, 2024 @03:28PM (#41164570)
Does 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?

Re:C++'s `Noexcept` Can (Sometimes) Help (Or Hurt) Performance by favorited on Monday August 05, 2024 @04:29PM (#41165263)
The 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).

Re:C++'s `Noexcept` Can (Sometimes) Help (Or Hurt) Performance by g15jv2dp on Monday August 05, 2024 @10:52PM (#41167430)
> Does C++ std::terminate unwind the stack and call destructors?

No, it doesn't. Try this: https://godbolt.org/z/cvG17cYEs