Alternative Titles (to aid search)
- Convert a preprocessor token to a string
- How to make a char string from a C
In C, string literals are concatenated automatically. For example,
const char * s1 = "foo" "bar";
const char * s2 = "foobar";
s1 and s2 are the same string.
So, for your problem, the answer (without token pasting) is
#ifdef __TESTING
#define IV_DOMAIN "domain.org"
#elif __LIVE_TESTING
#define IV_DOMAIN "test.domain.com"
#else
#define IV_DOMAIN "domain.com"
#endif
#define IV_SECURE "secure." IV_DOMAIN
#define IV_MOBILE "m." IV_DOMAIN