Well, constant and enumeration serve different purposes (although there is some obvious coincidence). so just donβt go too far from what people expected unless you have really good reason to break this rule.
I personally donβt like the heading "global constants", since you usually associate these ads with what they are used with. for example, the Apple infrastructure typically declares enumerations next to the interfaces to which they relate, and notification names in the same header as the class.
besides that, you have correctly declared yourself.
if you are using C ++ or objC ++ then you will want to fix it extern because the names may be different and this can lead to link errors.
something like this should do the trick:
#if defined(__cplusplus) #define MONExternC extern "C" #else #define MONExternC extern #endif
then you declare BOOKS as follows:
MONExternC int const BOOKS;
one more note, and this can only be illustrative in your example: these identifiers are very short and can easily cause conflicts with other identifiers.
justin
source share