Using the C preprocessor with D code

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 5 21:38:04 PDT 2017


On Wed, Apr 05, 2017 at 06:21:48PM -0700, Walter Bright via Digitalmars-d wrote:
> On 4/5/2017 1:50 PM, H. S. Teoh via Digitalmars-d wrote:
> > Who says you can't use a preprocessor with D code? ;-)
> 
> There are some issues with it. The C preprocessor is defined to work
> on "preprocessor tokens", which are not quite the same thing as text.

Well, yes, but since D syntax is sufficiently close to C, the difference
is immaterial. :-)

Mostly, anyway.  I can see the preprocessor getting confused by
D-specific syntax like token strings or `` literals, but for the most
part if the purpose is to expand C macros into D code snippets, this
mostly shouldn't matter.


T

-- 
Не дорог подарок, дорога любовь.


More information about the Digitalmars-d mailing list