Hi all,
I've noticed that I was using typedef enum and enum without typedef, mixed together.
​Some research/ reading tought me that there's really no difference when you use a c++ compiler, in either way I can simply declare variables without nothing 'enum' (in C it would be this exact difference I believe).
No my question, so far I've explicitly assigned values to my enums, like this:
enum CR_MOUSE_BUTTON
{
CR_MOUSE_BUTTON_L = 0,
CR_MOUSE_BUTTON_M = 1,
CR_MOUSE_BUTTON_R = 2
};
But from what I understand, is that this results in exactly the same as this:
enum CR_MOUSE_BUTTON
{
CR_MOUSE_BUTTON_L,
CR_MOUSE_BUTTON_M,
CR_MOUSE_BUTTON_R,
};
Because the compiler will automatically assign values, going through a list of possible standard types to use (int's, longs etc.).
​I also believe that this also works:
enum CR_MOUSE_BUTTON
{
CR_MOUSE_BUTTON_L,
CR_MOUSE_BUTTON_M = 10,
CR_MOUSE_BUTTON_R
};
In this case, L/left would get value 0, and R would get value 11 (++ from the forelast enum with value 10).
I just want to be sure if the assumptions above our correct, so I can continue with this knowledge (and remove unnecessary values assignments, because in my use-cases I think I can easily get away without assigning any values to the enums).
Any input is appreciated, as always.