Hello Christoph,
thanks for your reply. I completely agree that the definition should be done externally. But we should also have it implemented as constants because the source code is much clearer if it reads if (quality & OVERFLOW) {...}
instead of if (quality & (1<<4) ) {...}
Yes, that's the way I would have implemented it. I just proposed the "eye candy" thing because the 1, 10, 100 looked like it.
Quote: |
Please don't do the definition of numbers in header files; rather use the initialisation list.
|
Yes, you are right. However, for static const I sometimes make an exception because
- They are not real variables. I think the compiler "hardcodes" them during the optimisation anyway and does not even allocate memory for them.
- You have the variable names and the values in the same place.
- Doxygen includes the values.
- You don't need a .cpp and object file.
I usually interpret them as the "C++-version" of #define
Cheers
Martin