Why doesn\'t the commented out line in the following program compile?
#include
#include
using namespace std;
#define F1(a) 1
in
The preprocessor does not know about {}
initialisation. It sees the comma and thinks that's the start of a new macro argument. And then the next one. Only brackets ()
are things that it knows about.
[C++11: 16.3/11]:
The sequence of preprocessing tokens bounded by the outside-most matching parentheses forms the list of arguments for the function-like macro. The individual arguments within the list are separated by comma preprocessing tokens, but comma preprocessing tokens between matching inner parentheses do not separate arguments. [..]