We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi Here is the code I have problems with I an just starting to use this C compiler Have used many others, mainly closer to C99
#define Num_LANGUAGEs 6 enum _LANGUAGE { eUSING_LAN_START = -1, // This is always the First item eUSING_ENGLISH, eUSING_ITALIAN, eUSING_FRENCH_Can, eUSING_LAST_LANG // This is always the Last item }; #if Num_LANGUAGEs != eUSING_LAST_LANG #error "Warning Not enough Lang defined" #endif
If that is true, then surely that is a fundamental change to the very concept of the preprocessor Actually that is not true. I've made a mistake. Here is an extract from the C99 standard: The expression that controls conditional inclusion shall be an integer constant expression except that: it shall not contain a cast; identifiers (including those lexically identical to keywords) are interpreted as described below; (footnote 140) and it may contain unary operator expressions of the form defined identifier or defined ( identifier ) ... footnote 140: Because the controlling constant expression is evaluated during translation phase 4, all identifiers either are or are not macro names — there simply are no keywords, enumeration constants, etc. - mike
That's a relief!