I'm not quite sure what you are asking, but this approach will automatically generate the values ββin step 8 and make it relatively easy to insert new values ββin the middle of the enumeration and update all of the following values ββto accommodate the change:
enum
{
foo
bar = foo + 8,
baz = bar + 8
}
After editing, to add a "new value", you must:
enum
{
foo
bar = foo + 8,
newvalue = bar + 8,
baz = newvalue + 8
}
You can also use the Step constant so that you can (a) change your mind about the step later and (b) stop any accidental addition of the wrong step:
const int EnumStep = 8;
enum
{
foo
bar = foo + EnumStep,
baz = bar + EnumStep
}
source share