More questions about constants
1. There seem to be a number of opinions about how a const int (NOT a class member) should be declared & defined.
For example, in this thread
http://cboard.cprogramming.com/showt...ts+header+file
Elysia says "Don't put any variables in headers. Define them in a .cpp file and use extern in the header files."
In this one, Daved recommended defining a constant in a header file but enclosed in an unnamed namespace, ChaosEngine says to define it in a header file (wrapped in a #ifndef ... #endif block) as static const int, and CornedBee says that neither the static nor the namespace is necessary.
http://cboard.cprogramming.com/showt...nstants+header
I didn't find any clear statement on this from either Salem or Prelude. I'd love to get some further guidance on this -- is a consensus possible?
2. Sort of related to the above, does "static" have any significance in C++ when used OUTSIDE of any class definition? Is there any difference between a global "static const int x" vs. a global "const int x"?
3. This
http://www.parashift.com/c++-faq-lit....html#faq-29.7
sums up the reasons to prefer using const over #define, but it also says that there are cases when #define is preferable. So, when is #define preferable?