Add ImportC compiler to dmd

Brian bcallah at openbsd.org
Mon May 10 02:22:40 UTC 2021


Hi Walter --

Though still new to D, I really like this idea. Some rather 
trivial meta comments below.

On Monday, 10 May 2021 at 01:45:22 UTC, Walter Bright wrote:
> 5. We will have complete control over it. We can adjust it so 
> it works best for us. We don't need to fork or get anyone's 
> buy-in. We control the user experience.
>
> 8. There are a lot of wacky C extensions out there. We only 
> need to implement currently used ones (not the 16 bit stuff), 
> and only the stuff that appears in C headers.
>
> 9. Without a C compiler, we're stuck with, wedded to, and 
> beholden to libclang. I wouldn't be surprised that the eventual 
> cost of adapting ourselves to libclang will exceed the cost of 
> doing our own C compiler.
>

Completely agree with these 3 related points. The only thing I 
would add is that ANSI C11 is a start but it might be worthwhile 
to think sooner rather than later about what if any extensions 
are to be accepted and what the process would like like to 
incorporate those extensions. GNU C is a de facto standard. Even 
if that was relaxed to LLVM C, that is still a number of 
extensions. But I think this can be overall a tomorrow problem, 
so long as the initial considerations aren't too many tomorrows 
from now.

> 11. C++ can compile C code, which is a ginormous advantage for 
> C++. Can we afford not to do that?
>

As a new user to D, I was legitimately surprised that D didn't 
already compile C with the very explicit writings about 
DasBetterC, going so far as to having a -betterC flag. Perhaps 
that was my mistake in understanding the language. I wonder how 
many other newcomers also experience that confusion.

~Brian


More information about the Digitalmars-d mailing list