Recently, in this question , I saw an enumeration used to define a single value. eg:
enum { BITS_PER_WORD = 32 };
Instead:
#define BITS_PER_WORD 32
Assuming no more participants will be added later, what - if any - are the benefits of this? (or is it more a matter of personal taste)
In other words, if I have existing code using one-time int values, are there any good reasons to change them for the one-time enumerations shown above?
Out of curiosity, I compared the GCC-optimized assembler output for some non-trivial code, and the result did not change between the two enumerations / defines.
source share