4 ms·
> I don't know how Rust's RAII deals with exceptions thrown by lower level code. Unwinding across an FFI boundary is considered undefined behavior. https://do
by steveklabnik 9y ago
> I don't know how Rust's RAII deals with exceptions thrown by lower level code.
Unwinding across an FFI boundary is considered undefined behavior.
https://doc.rust-lang.org/reference/behavior-considered-undefined.html#behavior-considered-undefined https://doc.rust-lang.org/reference/behavior-considered-unde... last bullet point.
- WalterBright 9y agoThat's exactly what I wanted to know. Thanks! Full D is compatible with foreign exceptions and unwinding. I'll see about making D as Better C also compatible, but I suppose Rust's precedent makes it acceptable to not handle it.
- steveklabnik 9y agoNo problem! This isn't my super strong area of expertise, but don't you have to specify how the unwinding works? I believe this is part of the reason why Rust punted; you'd have to specify exactly what kind is supported. (Rust uses libunwind for panics, incidentally.)
- WalterBright 9y agoThe how is handled by providing a language-specific "personality" function in the generated exception tables. The D runtime library has one for D. But with D as Better C, I'd have to find a way to make the C personality function work for D.
- steveklabnik 9y agoAh right, makes sense. Thanks :)