8 ms·
He missed one important thing - the C preprocessor is completely unaware of C types. Its expressions follow different rules. A major goal of D was to make the
by WalterBright 7y ago
He missed one important thing - the C preprocessor is completely unaware of C types. Its expressions follow different rules.
A major goal of D was to make the language expressive enough to not leave room for the preprocessor:
1. modules
2. manifest constants
3. nested functions
4. lambdas
5. static if
6. compile time function execution
7. string mixins
- TheSoftwareGuy 7y agoI don't think he did miss that, rather it simply wasn't on-topic for the article he was writing. Anybody who has used the C preprocessor knows it works at the level of text/tokens and no further. The fact that it knows nothing of types would hardly be "scandalous" But you can go ahead and use this thread to promote D anyways.
- WalterBright 7y agoThe #if does more than just text and tokens, it has an expression grammar (constant-expression). It's implementation-defined whether the following two produce the same value: #if 'z' - 'a' == 25 if ('z' - 'a' == 25) Another difference is all constants are typed as intmax_t and uintmax_t, not the usual C types. Yes, it does have types. This difference in behavior from C expressions is not necessary.