Using preprocessor macros to compose another macro call
<p>Suppose I have a C++ preprocessor macro defined as follows:</p>

<pre><code>#define X(s) std::cout &lt;&lt; #s
</code></pre>

<p>if I use it directly:</p>

<pre><code>int main() {
    X( hello );
}
</code></pre>

<p>It works as expected and "hello" is printed on the console.</p>

<p>If I define another macro that calls it:</p>

<pre><code>#define Y X( hello )
#define X(s) std::cout &lt;&lt; #s

int main() {
    Y;
}
</code></pre>

<p>It still works.</p>

<p>However if I try to compose the call to <code>X</code> from two or more different macros, I get a whole bunch of errors:</p>

<pre><code>#define A X(
#define B hello
#define C )

#define X(s) std::cout &lt;&lt; #s &lt;&lt; '\n'


int main()
{
    A B C;
}
</code></pre>

<p>See output at: <a href="http://cpp.sh/5ws5k" rel="noreferrer">http://cpp.sh/5ws5k</a></p>

<p>Why can't I compose a macro call from two or more macro expansions, doesn't preprocessor expand them recursively?</p>