Zack Weinberg <[EMAIL PROTECTED]> wrote: >>> This doesn't do what I want at all. The goal is to make the *symbolic >>> enumeration constants* inaccessible to most code. >> > ... >> If it's OK to have the enums in a header, provided you can't *use* them... >> >> enum { >> #ifdef TVQ_AUTHORITATIVE_ENUMS >> TVQ_FOO1, >> TVQ_FOO2, >> TVQ_FOO3, >> TVQ_NUM_ENTRIES, >> #endif >> TVQ_INT_SIZER = 32767; >> } TheValQuux; >> >> This won't stop a suitably enthusiastic programmer from getting to >> them anyway, but that's always the case. > > Ooh, I like this one for enum machine_mode.
I think this is an ODR failure for C++ and I suspect program-at-a-time would flag it with an error. So even this solution to hide enum constants (a legitimate design request) does not appear to be C++ compatible to me. -- Giovanni Bajo