How does the C preprocessor know what to expand and what not?

Say we have a macro defined as such

#define VALUE_ENTRY(a, b, c, d, e, f, g) \
    case E_##a##e: temp.a##e = d; break;

How does the preprocessor know that the "e" in "temp" should not be expanded? Is it due to a lack ##of an “e”?

Also, if temp.a##ebe temp.##a##e?

+4
source share
1 answer

The preprocessor works with tokens. eBy itself is a token, while ein tempis just a symbol, which is part of a larger token temp. ##only applies to tokens.

, . . a ; temp.a##e a e temp.<a><e>, <a> <e> a e.

+6

Source: https://habr.com/ru/post/1685564/


All Articles