T
Tobias Blass
Hi,
I'm currently implementing a string lookup table, mapping error numbers to
human readable strings. So my question is: Can I put the strings in a header
file, or will I end up with N exact copies of this array (N being the number
of inclusions of this file). I use gcc on Linux, so if anyone can tell me that
gcc will optimise N-1 copies of the array out I'm happy with that, too.
/* error.h */
#ifndef ERROR_H
#define ERROR_H
const char *errstrs[]={
"first error",
"second error",
...
};
#endif
I'm currently implementing a string lookup table, mapping error numbers to
human readable strings. So my question is: Can I put the strings in a header
file, or will I end up with N exact copies of this array (N being the number
of inclusions of this file). I use gcc on Linux, so if anyone can tell me that
gcc will optimise N-1 copies of the array out I'm happy with that, too.
/* error.h */
#ifndef ERROR_H
#define ERROR_H
const char *errstrs[]={
"first error",
"second error",
...
};
#endif