How many different ways are there to define constants in C or C++?
I am already aware of using the const keyword and the #define directive. I heard somewhere that there are two more ways to define constants, but I’ve never seen any others.
Are there any others?
enum, as inenum { some_constant= 2 };EDIT: I also forgot the additions of
constexprand user defined literals in the C++0x standard. So there are actually three additional ways.