Macro expansion is not performed recursively, if the macro name appears in the replaced text, it no longer extends. So,
#define B 100 + B
replacing B gives a token sequence of 100 + B and B does not expand again (if that were the case, you would have infinite recursion). Thus, the compiler sees a reference to the undeclared variable B after the preprocessor completes.
But in
#define B 100 #define A 100 + B
when macro A is expanded, macro B will appear in the replacement text. Then B expands and the compiler sees 100 + 100 , which does not contain references to undeclared variables.
source share