Enumerated Constants
DataFlex provides the Enum_List command for declaring a sequence of integer constants of increasing value. Enumerated constants are declared using the following syntax:
enum_list
define {Identifier}
define {Identifier}
define {Identifier}
…
end_enum_list
Where:
- {Identifier} is the name assigned to the new integer constant. By default, the first identifier will be assigned the integer constant 0, the second 1, then 2, and so on.
Example Declaration
An example declaration of enumerated constants follows:
enum_list
define C_NoError // this symbol = 0
define C_MinorError // = 1
define C_Error // = 2
define C_CriticalError // = 3
end_enum_list
You can skip a number in the default sequence by introducing a for clause in the define. For example:
enum_list
define C_NoError // = 0
define C_SysError1 for 1000 // = 1000
define C_SysError2 // = 1001
define C_SysError3 // = 1002
end_enum_list