On Monday, 10 May 2021 at 08:53:57 UTC, Gregor Mückl wrote:
>On Sunday, 9 May 2021 at 20:57:06 UTC, Walter Bright wrote:
>https://github.com/dlang/dmd/pull/12507
If you could add a C compiler to dmd with 3000 lines of code, so C code could be imported directly? I would!
How does this impact gdc as part of GCC? GCC already has a C compiler, so this could be seen as some kind of duplication of features/effort from their perspective.
Not really a duplication, as it is contained to the D front-end with no reliance on GCC infrastructure.
Integration is another matter though, as all GCC compilers know about all languages that have been enabled, and what file extensions they handle. i.e: gdc foo.c bar.d baz.go
will invoke the C, D and Go compilers separately in one execution step:
cpp foo.c -o foo.i;
cc1 foo.i -o foo.o;
d21 bar.d -o bar.o;
go1 baz.go -o baz.o;
ld foo.o bar.o baz.o -o a.out
While it might be wishful thinking to register C source files against the D compiler (so gdc foo.c
calls the preprocessor and compiler in one step), that could cause a conflict with gcc and g++ calling the D compiler when they themselves handle C source files.
Importing C source files into D modules is another thing (the D front-end is already compiling), and doesn't affect the above mentioned machinery.