If you have two const arrays of int, with the same content, why do you need two arrays?
Since const arrays are fairly rare, and multiples that are exactly the same value is even rarer, it makes little sense to optimize for that, as there's a very obvious "manual" optimization for it - have only ONE array.
However, for string literals, it's quite common do do things like this:
Code:
char *strings[] = { "Unknown", "Unknown", "Unknown", "Unknwn" };
...
if (something)
strings[i] = mystring;
...
// or this variation:
printf("%d\n", a);
printf("%d\n", b);
printf("%d\n", c);
printf("%d\n", d);
printf("%d\n", e);
printf("%d\n", f);
printf("%d\n", g);
printf("%d\n", h);
...
// or
#define MESSAGE "Some string we print here and there\n"
...
printf(MESSAGE);
...
printf(MESSAGE);
...
if (somethign)
printf(MESSAGE);
So there is much more scope for optimising the string literal multiples than there is scope for optimizing const int arrays.
--
Mats