ImportC and nothrow/@nogc?

Walter Bright newshound2 at digitalmars.com
Mon Aug 26 05:39:23 UTC 2024


On 8/23/2024 11:23 PM, Dukc wrote:
> OTOH a C function `longjmp`ing is like a D function throwing unrecoverable 
> errors. It's still `nothrow`, it's just that `setjmp`ing (like catching 
> unrecoverables) is unsafe, since it can break the D type system by skipping 
> destructors and `finally` blocks.

The fact that C++ compilers that translate C++ to C code use setjmp/longjmp to 
implement EH is sufficient to explain that. If that's not enough, take a look at 
how it is implemented. It uses the same EH scheme as C++ does.


More information about the Digitalmars-d mailing list