A Few thoughts on C, C++, and D

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Tue May 30 23:52:00 PDT 2017


On 2017-05-30 21:42, Ola Fosheim Grøstad wrote:
> On Tuesday, 30 May 2017 at 19:12:28 UTC, Jacob Carlborg wrote:
>> Currently DStep cannot handle #if or #ifdef.
>
> Oh, that is often required…

Yes, but it's very difficult to do.

Say there's some code looking like this:

#ifdef Windows
#include <windows.h>
DWORD foo();
#else
int foo();
#endif

Ideally that should be translated to:

version (Windows)
{
     import core.sys.windows.windows;
     DWORD foo();
}
else
{
     int foo();
}

But trying to compile the code in the "body" for Windows, on any other 
platform will fail because windows.h is not available.

> My impression is that there is no consensus? So still a possibility then.

Good look convincing Walter that DMD should depend on DStep and LLVM.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list