Uphill
Atila Neves via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 1 11:44:01 PDT 2015
> I'd say C has embraced macros for good reasons, as a
> minimalistic language design strategy (newest C version using
> it for generics), but C++ has no longer an excuse for providing
> it.
Excuses for C++ :
1. Backwards compatibility with existing C++ code
2. Being able to call C code that depends on macro definitons to
actually work
3. The aforementioned cases in which templates can't do the job
With regards to #3: see when you use `mixin` in D code? You need
a macro to achieve the equivalent task in C++. It's either that
or boilerplate. Yay when I get to write D, boo when I just have
to use C++. I feel dirty every time I type `#define`, but I'd
feel dirtier if I repeated code all over the place. As always,
it's a trade-off.
Atila
More information about the Digitalmars-d
mailing list