I use switch & case as a state-machine
I like how I can have break inside a if-statement
and can do instant fall-through when I want it.
First I thought about making all case's anonymous by using a
macro and __COUNTER__
But I like some case to have a Name so they float if other case's are added example state(END): and I make the macro define/enum that name with __COUNTER__
But that don't allow forward declaration.
So I guess only option is a create precompile program that creates a __.h file with the enum named states?
and also edits the .c file and inserts a number for the anonymous states.
Any thoughts? I use IAR Workbench.