Take a look at this code:
#include <iostream>
using namespace std;
#define foo bar
#define string(a) #a
#define concat(a,b) string(a ## b)
#define concat2(a,b) concat(a,b)
int main()
{
cout << concat(foo, baz) << '\n' << concat2(foo, baz) << endl;
}
The output of this program is:
foobaz
barbaz
Why does adding an additional level of indirection change the behavior of this code?