I have a very specific question about the translation limits of C (as defined in the ANSI/ISO 9899:X standards family) regarding enumeration constants.
I have some thousand individually indentifyable data sources, I'd like to enumerate. Also I want to respect the minimal translational limits of the C-Standard, as the actual limits are implementation defined, and exceeding those is undefined behavior (see Is it undefined behavior to exceed translation limits and are there checker tools to find it?).
I know that there are translation limits on the number of enumeration constants within the same enum (C90: 127), the number of identifiers specified within the same block (C90: 127) and external identifiers within a translation unit (C90: 511).
I think enumeration constants do not have a linkage (please correct me), and surely I can place them out of block scope ... so puts any translation limit constraints to the following pattern (besides the limits of integral types of the target plattform, and of course the number of constants within one single enum) - and if so, why?
MyEnumeration.h
---------------
enum e1
{
VAL11 = 0,
VAL12,
/* ... */
VAL_1N,
END1 = VAL_1N
};
enum e2
{
VAL21 = END1,
VAL22,
/* ... */
VAL_2N,
END2 = VAL_2N
};
/* ... */
enum eN
{
VALN1 = ENDN_1,
VALN2,
/* ... */
VAL_NN,
ENDN = VAL_NN
};
#define NUM_ENUM ENDN
Note: Switching to #define won't help, as there are also translation limits on defined marco identifiers (C90: 1024). I would be forced to #undef in a complicated way, maybe with a complex #include pattern.