static const int k1 = 32767 #define k1 123
C++ will the compilers use the same code for these two cases?
And if plain C (C99) ?
(setting aside size_t)
I guess #define has a scope of the entire file? Module? And static const in a class has just that scope? and so on. Implicit secret rules.
Will some compilers create read-only storage for this constant if the target CPU has no "load immediate" for a number that large?
If the constant were smaller, say, 12 (or 255 is another case), and it might make a difference for some kinds of CPUs? (The range of a load immediate is small in some CPUs, like 5 bits or so)