ImportC can now automatically run the preprocessor

Walter Bright newshound2 at digitalmars.com
Sun May 15 17:41:37 UTC 2022


On 5/15/2022 6:09 AM, Nick Treleaven wrote:
> Integrated C support with D has never been done before, and Walter never claimed 
> supporting all preprocessor macros would work.

In fact I specifically said that the preprocessor macros would never fully work. 
Even though one could feed D source code through the C preprocessor, it will 
fail to preprocess, as D does not wholly consist of preprocessor tokens. (The 
ancient K+R preprocessor would, but standard C wedded the preprocessor semantics 
to C.)


> ImportC was very useful even not 
> long after it was first merged. I'm surprised at some of the negativity from 
> people here.

I'm not. I've done many projects that were universally derided as "who needs 
that" until they got their hands on it. :-)

I've also done many projects that everybody wanted, until I delivered it. (dscript)

It's kinda hard to tell these things in advance, especially if they involve a 
change in the way people are used to doing things.


> Features are not given up on unless they're deprecated. The problem is manpower 
> and getting through the dip process. The waterfall software development method 
> is well known. I think your narrative is unfair and breeds negativity about D. 
> The problems can often be solved, and when they can't it's because it's a 
> problem with no known good solution or a trade off. But none of that is relevant 
> to ImportC, which has obvious merit yet requires more work but clearly will pay 
> its way.

And now with:

   https://github.com/dlang/dmd/pull/14128

you can pass preprocessor commands to cpp when using ImportC. Getting better 
every day!


More information about the Digitalmars-d mailing list