I want to assemble a char array that contains one byte with a compile time constant value and a string, which is also compile time constant. Solution would be:
char packet[] = "\x42" __DATE__;
That works but is not very readable and maintainable, as that 0x42 is a message opcode that is used elsewhere, making this a magic number. Now, I could put a dummy x into the string and follow this definition with an assignment like this:
#define OPCODE 0x42
char packet[] = "x" __DATE__;
packet[0] = OPCODE;
But I have the feeling that could be done in a purely constant string literal, I just can't find how to do it. Any idea?