I'd like to initialize string constants such that the high byte of each character can be nonzero.
The string constants are pointed to by members of a struct as in the following code:
struct foo_struct {
char *s;
};
const struct foo_struct foo = { "\x2021\x2223" };
When compiling this code I get the warning:
"test.c", line 182: warning #27-D: character value is out of range
const struct foo_struct foo = { "\x2021\x2223" };
And the corresponding location in memory is initialized with 0x21, 0x23, 0x00.
I could achieve what I want by doing something like this:
struct bar_struct {
const unsigned *u;
};
const unsigned u_ar[] = {0x2021, 0x2223, 0};
const struct bar_struct bar = { u_ar };
What I don't like with this approach is the requirement of the intermediate array u_ar. I don't need that, since I only access the data using the pointers in the structures.
I'd appreciate any hints on how to initialize string constants such that both bytes of a character can be used (I want to save some memory).
BTW, is there a more recent User's Guide to the compiler than spru514c.pdf? spru514c.pdf is marked preliminary and for version 5.0.0 of the compiler. I'm using version 5.2.3 now.
Thanks in advance
Johannes