The reason you cannot change or redefine OUTDEG or any member of SchedType is simply because all of the members are made constant. That's the purpose of enum is a list of constant values.
And to answer your question, there is no reason to assign it the default value of 0. It's made 0 when declared.
It's value can be assigned while declaration. You can start it from any value you want.
Consider the following examples:
Example 1:
enum {BLUE, GREEN};
Value BLUE = 0; // Default value if not specified
GREEN = 1;
Example 2:
enum {BLUE = 12, GREEN};
Value BLUE = 12; // Assigned value
GREEN = 13; // Since value of the element before this is 12 and the value of this has not been assigned. Therefore,
// prev_val+1
Example 3:
enum {BLUE = 19, GREEN = 10};
Value BLUE = 19; // Assigned value for BLUE
GREEN = 10; // Assigned value for GREEN
Example 4:
enum {BLUE=12, GREEN=8, YELLOW};
Value BLUE = 12; // Default value if not specified
GREEN = 8;
YELLOW= 9; // Again, since not specified, therefore prev_val + 1
enum SchedType {OUTDEG=0, SQRT_OUTDEG, UPLOAD_BW, SQRT_UPLOAD_BW};
void test(SchedType t)
{
return;
}
int main()
{
// This line will give you an error
OUTDEG = 3;
test(OUTDEG); // calls with SchedType::OUTDEG
// This line creates a new variable
// called OUTDEG nothing to do with SchedType::OUTDEG
// but will hide it
int OUTDEG = 3;
//this line will now give you an error
test(OUTDEG);
return 0;
}