digitalmars.D - D compiler as a C++ preprocessor
- Dmitry Sychov (3/3) May 30 2009 Hello,
- grauzone (1/2) May 30 2009 No.
- bearophile (4/5) May 30 2009 It may be possible to induce LDC to output C code.
- Frits van Bommel (11/15) May 30 2009 With the LLVM C backend linked in it might come close to working. There ...
- Sergey Gromov (7/10) Jun 28 2009 I'm sure translation from D into C were discussed before, not even once,
Hello, Can D compiler be used only as a C++ preprocessor, that it to generate C++ output (platform independent) to be later compiled via the target platform C++ compiler? Thanks, Dmitry
May 30 2009
Can D compiler be used only as a C++ preprocessor, that it to generate C++ output (platform independent) to be later compiled via the target platform C++ compiler?No.
May 30 2009
Dmitry Sychov:Can D compiler be used only as a C++ preprocessor, that it to generate C++ output (platform independent) to be later compiled via the target platform C++ compiler?It may be possible to induce LDC to output C code. Bye, bearophile
May 30 2009
bearophile wrote:Dmitry Sychov:With the LLVM C backend linked in it might come close to working. There are some issues with this, though. First of all, the C backend is a bit out of date. LLVM has started turning some stuff into large integers (> 64 bits), and last I heard the C backend can't handle those properly. (Other backends handle them just fine since pretty much only bitwise operations are generated for them, not more tricky stuff like multiplication and division) Second, it still won't be platform independent, which was what Dmitry asked for. This is because LLVM doesn't see the code until templates are instantiated, mixins are mixed in, static ifs and versions have been evaluated, and so on.Can D compiler be used only as a C++ preprocessor, that it to generate C++ output (platform independent) to be later compiled via the target platform C++ compiler?It may be possible to induce LDC to output C code.
May 30 2009
Sat, 30 May 2009 04:16:09 -0400, Dmitry Sychov wrote:Can D compiler be used only as a C++ preprocessor, that it to generate C++ output (platform independent) to be later compiled via the target platform C++ compiler?I'm sure translation from D into C were discussed before, not even once, as a means of diversifying the list of supported platforms. The culprit was exception handling. The conversion to C++ were discussed too IIRC, but not as enthusiastically for some reason. I cannot think of any real blockers for such a `preprocessor'. Maybe forward references, but the current D compiler has problems with them as well.
Jun 28 2009