One C++ programming book I have said that it's a better idea to use
const type x = value;
than
#define x value
Is there any truth to this? Which do you use?
I can think of two conceivable reasons to use const:
Constants have a type, which is important in a strongly typed language like C++.
Const may only need to be written into the program once. Not quite sure about this one, but it's possible that when using const, the compiler can use the same copy of the constant multiple places within the program.
Anybody have any useful information on this?