All over the Internet I see people advocating for the use of enum or const rather than #define for constant definition.Are there times when #define is more appropriate or equally appropriate?  Please explain.Are there times when #define is just awful?  Please elaborate.  (You can say 'always' if you really wish, but I'm looking for more specific answers.)(Yes, I am trying to justify my use of #define, which to me looks so much neater.)
Is there an appropriate use for #define for constants?
c++
To keep it simple: they're right and you're wrong.There's rarely a good reason to use #define for a constant in C++. Yes, they're pretty awful. In particular, they completely ignore the scopes for normal identifiers, and instead always have file scope.You can work around that (e.g., using prefixes on names you define to avoid collisions) but even at best they don't fit very well with the rest of the language.I suspect you're thinking it looks neater is more a matter of habituation than any intrinsic superiority -- when I first started moving from C to C++ I tended to feel the same way. Purely intellectually I could understand the points being raised, but emotionally they just seemed wrong. For a while I considered it kind of silly to change something that had worked find forever. I had to really force myself to use const instead, and at first didn't really believe in it -- but fairly quickly I not only got used to it, but ended up admitting that it really was better.