Live data from Hacker News

Next C compiler is a D compiler: Introducing DMD's ImportC

briancallahan.net

11–20 of 89 posts

Re: Next C compiler is a D compiler: Introducing DMD's ImportC

#13
The article's title is "Your next C compiler is a D compiler", which makes sense, though it's a bit clickbaity. The HN submission title is "Next C compiler is a D compiler", which barely makes grammatical sense, and to the extent that it does make sense, it sounds like there's a C compiler called "Next C compiler" which is also a D compiler.

Re: Next C compiler is a D compiler: Introducing DMD's ImportC

#14
post #9

This is just like Zig's C compiler

Zig doesn't have a C compiler yet, it bundles clang. Someone in the community was working towards a C compiler in Zig though.

ImportC is basically a C frontend for the D compiler, semantics are close enough but there are some changes to be made still.

Re: Next C compiler is a D compiler: Introducing DMD's ImportC

#15

Walter, since you're here: what's your position regarding bootstrapping and Ken Thompson's "Reflections on Trusting Trust"?

The D compiler will steal your passwords, but only for old VAX BSD versions of passwd, so Walter can log in and fix your K&R C bugs while you're sleeping.

your daily edition of WalterBrightFacts™

Re: Next C compiler is a D compiler: Introducing DMD's ImportC

#17

> Error: C designator-list not supported yet I guess only a subset of C11 is supported? Is there all of C89?

Interesting.. i personally use that a lot in C, this lib for example:

https://github.com/floooh/sokol#sokol_gfxh

I couldn't live without it

https://dlang.org/spec/struct.html#static_struct_init

D support it, what's blocking it?

Re: Next C compiler is a D compiler: Introducing DMD's ImportC

#18
post #13

The article's title is "Your next C compiler is a D compiler", which makes sense, though it's a bit clickbaity. The HN submission title is "Next C compiler is a D compiler", which barely makes grammatical sense, and to the extent that it does make sense, it sounds like there's a C compiler called "Next C compiler" which is also a D compiler.

My mistake. Thanks for pointing it out.

Re: Next C compiler is a D compiler: Introducing DMD's ImportC

#19

Does ImportC support extensions like attribute cleanup yet? It is basically the same thing as D's scope(exit). More broadly, are there plans to support C extensions that are available in GCC and clang?

ImportC already supports some extensions, what we figured were the most used ones. We plan to support others on an as-needed basis.

Re: Next C compiler is a D compiler: Introducing DMD's ImportC

#20
post #9

This is just like Zig's C compiler

Zig doesn't have a C compiler yet, it bundles clang. Someone in the community was working towards a C compiler in Zig though. ImportC is basically a C frontend for the D compiler, semantics are close enough but there are some changes to be made still.

Zig does have "translate-c", which attempts to convert C code to Zig code. Similarly to D, it's used for a feature to automatically import C headers into a Zig program. But even that's based on libclang's parser and AST.
Post reply on HN