How does this enum declaration work ?

I recently came across this code which usesd enums,and switch cases. I saw this declaration for the enum:

enum : byte {IDLE, MIDDLE, END} start = IDLE;

What is the purpose of the "byte" part and also the part after the the curly parenthesis "start = IDLE".
Also why does the enum have no name.

Is there any documentation explaining this as I cannot find any similar structures for this enum

fxokdo:
What is the purpose of the "byte" part...

By default int sized storage (2 or 4 bytes) is used. The byte part reduces that.

fxokdo:
...and also the part after the the curly parenthesis "start = IDLE".

Declare a variable named start then assign that variable an initial value.

fxokdo:
Also why does the enum have no name.

Not needed. C++ supports anonymous types.

fxokdo:
Is there any documentation explaining this as I cannot find any similar structures for this enum

In my experience, Microsoft provides fairly good C++ documentation.

fxokdo:

enum : byte {IDLE, MIDDLE, END} start = IDLE;

[..] the part after the the curly parenthesis "start = IDLE".

I think this code should be read as:

 enum : byte {IDLE, MIDDLE, END};
 start = IDLE;

fxokdo:
Is there any documentation explaining this as I cannot find any similar structures for this enum

https://playground.arduino.cc/Code/Enum/

Erik_Baas:
I think this code should be read as:

 enum : byte {IDLE, MIDDLE, END};

start = IDLE;

Nope, that won't work. You can't declare 'start' without giving it a type and you can't use an anonymous type because it has no name. One option:

 enum EnumName : byte {IDLE, MIDDLE, END};
EnumName start = IDLE;

This might also work. 'automatic' means "Use the type of the initializer.":

 enum : byte {IDLE, MIDDLE, END};
automatic start = IDLE;

Erik_Baas:

enum : byte {IDLE, MIDDLE, END};

start = END;



Nope: compiler says "'automatic' was not declared in this scope".

Sorry, I got the keyword wrong. It should have been 'auto', not 'automatic'. It's a relatively new feature so I have used it very little.