ONC+ Developer's Guide


Enumerations have the same representation as signed integers and are handy for describing subsets of the integers. The encoding for enumerations is the same as shown in Signed Integer Encoding.

Enumerated data is declared as follows.

enum {name-identifier = constant, ... } identifier;

For example, an enumerated type could represent the three colors red, yellow, and blue as follows.

enum {RED = 2, YELLOW = 3, BLUE = 5} colors;

Do not assign to an enum an integer that has not been assigned in the enum declaration.