There are several main differences between enumerated constants and macros:
1. an enumerated constant is one of the entities, but the macro is not an entity;
2. an enumerated constant is a constant, but a macro is not a constant;
3. an enumerated constant has a type, but the macro has no type, and the enumeration variable has the same scope, value, and other properties as the normal variable, but the macro is not, and the macro is not part of the language, it is a preprocessing substitution. Enum types are used primarily for restrictive input, for example, a parameter of a function accepts only a finite number of values in a type, and other values are not accepted, which can be a good solution to this problem. You can use enumerations to use enumerations as much as possible, otherwise you won't be able to see the value at the time of debugging.
4. define a variable with a macro if you define a variable that depends on who is in front, if the macro is in front of the variable will produce a compile error, and this error is difficult to find, if the macro hidden deep. If you define a variable that is more frightening in the first place, there is no error directly, but the macro definition is silently replaced by the custom variable. With enumeration definitions, no matter how the sequence of relationships you define will result in duplicate-defined errors. From the example above, enumerations are much more useful than macros. A macro also has an attribute that has no scope, and the scope here is that macros can be used by code that is defined later in the macro. Macros can be repeated to define this may cause the value of the macro to be modified. Therefore, it is recommended that you do not use macros to define the variables for shaping, using enumerations or Const. It will also be useful to the const or enumeration, the world has always been so tangled, enumerations can only represent an integer, the const may modify any type. In the case of plastic surgery, if you want to define several relational values, use an enumeration, otherwise, use Const.