The point here is the order of expansion of macros.
In the first case, the macro expansion works as expected, X and Y are replaced with hello world, the preprocessor expands all three macros(CONCAT, X and Y), in the expression CONCAT(X,Y), to
_CONCAT(Hello, world) -> #Hello #world
and finally to
Helloworld
In the second case, the expansion of _CONCAT(X,Y), expands to #X #Y, hence the result.
Login in to like
Login in to comment