www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Why doesn't the D compiler include the C preprocessor for importC?

reply Ki Rill <rill.ki yahoo.com> writes:
I am genuinely curious about this. What are the arguments against 
it?
Jan 18 2023
next sibling parent "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
The only one that matters: licensing.

Although once mature I'm sure we can simplify the situation somewhat as 
part of the Windows installer.
Jan 18 2023
prev sibling parent reply Dave P. <dave287091 gmail.com> writes:
On Thursday, 19 January 2023 at 05:04:11 UTC, Ki Rill wrote:
 I am genuinely curious about this. What are the arguments 
 against it?
The main reason is that other compilers/platforms define a huge number of macros and extensions that real header files depend on. There is already a C preprocessor written in D (https://github.com/walterbright/warp) that could be used, but there’s an endless parade of predefined macros.
Jan 18 2023
parent Walter Bright <newshound2 digitalmars.com> writes:
On 1/18/2023 9:49 PM, Dave P. wrote:
 On Thursday, 19 January 2023 at 05:04:11 UTC, Ki Rill wrote:
 I am genuinely curious about this. What are the arguments against it?
The main reason is that other compilers/platforms define a huge number of macros and extensions that real header files depend on. There is already a C preprocessor written in D (https://github.com/walterbright/warp) that could be used, but there’s an endless parade of predefined macros.
You're right. It's (surprisingly) not that those preprocessors implement extensions. It's that they predefine several hundred macros, many of them being dependent on various switches. The documentation on it is weak to wrong to nonexistent, so one is faced with quite a problem trying to duplicate it. And then, of course, the behavior will change on the next release. It's like chasing a rainbow.
Jan 20 2023