#defines in header files should generally be avoided. That is because every file that includes a header with a certain #defined constant is not allowed to redefine that constant. And it is not even allowed to use the defined identifier in another context because it will be replaced by the preprocessor. #defines are
always global and they are independent from namespaces and scope.
So if you need to define a range of related constants, use an enumeration. If the enumeration is only used by a certain class, put it into the definition of that class and make it a local enumeration. This way, you prevent cluttering up the global namespace. If you need a single constant, unrelated to other constants, define it as a const variable, preferably inside a class definition.
If a range of constants should be used as flags as outRider pointed out, using an enumeration would be wrong. You could use #defines here, as the DirectX SDK headers do, but better yet use const declarations. And again, preferably inside a class definition or at least, a unique namespace. This way, nobody will ever have to worry when including your headers.
Source files (implementation files) are an entirely different topic. They will never be included anywhere, so feel free to clutter up the global namespace and go crazy with #defines - nobody will ever find out. As long as you can still maintain the code, it''s all right. But remember that consts and enums aren''t slower than #defines are - and they will be handled by the compiler, not by the preprocessor.
In general, constants should always be defined using the means provided by the language, not by the preprocessor. Macros are a different topic. They can really ease some tasks in implementation files and the are definitely not "evil" or anything.
Last but not least, if you really
have to use #defined constants in a header file (I can''t see an urgent reason, though), make them as unique as possible. Think about using a common prefix as the DirectX SDK headers do.
That''s it. Happy coding.