String Table

I am designing a rather large project (20 + source files) and would like to keep string literals in a string table so that they can be accessed throughout the application.

I'm using Qt so the string table resource is of course not available like in VS. My thought is to put them in a header file using enums and a constant array of QStrings. I could use a map, but then I have to pass the table around through signals and slots and across classes.

Is declaring strings like below in any way bad (inefficient or memory wasting)?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
enum
{
    ONE,
    TWO,
    THREE,

    MAX_STRINGS
};

const QString StringTable[MAX_STRINGS] = 
{
    "String one",
    "String two",
    "String three"
};


I would include this header in any location where strings are displayed to the user or error handling.
Topic archived. No new replies allowed.