Translating C macros to D

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 10 23:51:33 PDT 2017


On 2017-07-11 03:31, Cym13 wrote:

> Is not getting rid of the macro an option? By that I mean translating 
> the code inside the macro (which can admitedly be hard because it 
> doesn't have to be semanticaly correct code due to concatenations but 
> most macros aren't so evil) and add a pass of cpp to the build.

Not sure I fully understand. Could you give a concrete example? BTW, it 
might not be possible if the macros are part of the API and we want to 
keep the D API as close as possible to the C API.

> Of course nobody wants to use the C preprocessor on D code, but it would 
> work and I'd prefer ugly code that works and can be refactored than no 
> working translation at all personnaly.

Are you saying the D code could contain C preprocessor code?

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list