ImportC and nothrow/@nogc?

Walter Bright newshound2 at digitalmars.com
Tue Aug 27 22:22:12 UTC 2024


On 8/26/2024 10:26 AM, Steven Schveighoffer wrote:
> Does this actually interact with D code properly? Like, does this work?

Nope. D doesn't emit EH stack frames for nothrow functions.


> I don't think you understand the problem here.
> 
> `printf` doesn't use the GC. It doesn't throw. This is not conjecture or 
> philosophy, it objectively, explicitly does not do this.

I know everything there is to know about printf. I've implemented a Standard 
compliant one :-)

I've also proposed an exemption to make printf usable from @safe code.


> This must be fixed. There is no other option. If this is not fixed, you cannot 
> use importC to actually import C.

I remember when you were adamantly against C code defaulting to @trusted. 
Assuming nothrow and @nogc is in the same category.

I agree this is a problem.


More information about the Digitalmars-d mailing list