Obviously, #define is a little simpler.
#define WHATEVER 42 const int WHATEVER = 42;
I think using #define takes no space to store the value, as it is replaced before compilation.
Some things are impossible to do with a #define, however.
#define ONE 1 #define TWO ONE + ONE
That would be easy using constants.
const int ONE = 1; const int TWO = ONE + ONE;
So the rule of thumb is: 'if its incredibly simple, use #define, otherwise const', right?
Anything else that I'm missing?

New Topic/Question
Reply



MultiQuote











|