Who said no?
set(
#ifdef A
1
#else
3
#endif
);
The above snippet works as expected. Demo on Godbolt
#
is a special character that starts a preprocessor directive and must be at the start of the line (after optional whitespaces) so you must separate into new lines. Anyway that's not what people usually do, because they'll do like this
#ifdef A
set(1);
#else
set(3);
#endif
or
#ifdef A
#define VAL 1
#else
#define VAL 3
#endif
set(VAL);
Note that cout <<
is not C and you're missing a semicolon in the macro. It should be {cout<< x;}