There's no definitive answer. enum
offers you scoping and automatic value assignment, but does not give any control over the constant type (always signed int
). #define
ignores scoping, but allows you to use better typing facilities: lets you choose the constant type (either by using suffixes or by including an explicit cast into the definition).
So, choose for yourself what is more important to you. For a state machine, enum
might be a better choice, unless you have a good reason to control the type.