I found a lot of questions and answers concatenating strings with the C or C++ preprocessor; for instance this question (but there are many more).
What I couldn't find was whether it was possible to concatenate to the same string. To be more clear, something like this
#define MY_STRING "Hello"
#define MY_STRING MY_STRING " world"
// Now MY_STRING is "Hello world"
If I had to write it during "runtime", I would write something like
char my_string[80];
strcpy(my_string, "Hello");
strcat(my_string, " world"); // <- similar to this operation, but in preprocessor
Please note, however, that this is not what I'm trying to do; I want the concatenation to be performed at compile time.
Is this possible? Or a define is "immutable"?
This question is not about a particular flavor of C or C++; if this can be implemented in only one of the two languages or only with some particular compiler please specify it in the answer
EDIT: as Lightness Races in Orbit partially guessed, the main point of my question revolves around conditional compilation and, moreover, expandability.
As for conditional compilation, what I currently do is
#if COND_1
#define STR_COND_1 " val1"
#else
#define STR_COND_1 ""
#endif
#if COND_2
#define STR_COND_2 " val2"
#else
#define STR_COND_2 ""
#endif
#define STR STR_COND_1 STR_COND_2
The problem here is that this can lead to errors when the conditions become too many (it's easy to forget one), while a concatenation does not have this problem.
As for expandability, I mean that if I have to add another module which adds its string to the STR one (for instance, COND_3), I have to manually add it to the STR definition, while with a concatenation it is automatic.
Now, these examples are really easy, so forgetting it is difficult, but when you have a project where these things are scattered around in lots of files forgetting one variable is easy and can lead to a lot of time wasted