Why does this fail to compile?
char programDate[] = \"(\"__DATE__\")\";
But this compiles fine (see space):
char programDat
Since C++11, user-defined literals exist and are part of preprocessing. The grammar is:
preprocessing-token:
user-defined-string-literal
// other stuff...
user-defined-string-literal:
string_literal ud-suffix
ud-suffix:
identifier
So "("__DATE__ matches preprocessing-token, but "(" __DATE__ doesn't (that is two separate preprocessing tokens).
Macro replacement happens after tokenization. Since there is no token __DATE__ in your first example, there is no replacement.