Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Enum-type

jaeger0
Beginner
634 Views
I'm rewriting C to fortran code

So is there a nice construct for the enum-type in C, like

typedef enum {
EBO_unknown = 0,
EBO_LittleEndian = 1,
EBO_BigEndian = 2
} E_ByteOrder

So I have a lot of this types, and I don't want to make a constant variable for each type
0 Kudos
1 Reply
Steven_L_Intel1
Employee
634 Views

There is!

ENUM, BIND(C)
ENUMERATOR :: EBO_unknown = 0, EBO_LittleEndian=1, EBO_BigEndian=2
END ENUM

or

ENUM, BIND(C)
ENUMERATOR :: EBO_unknown, EBO_LittleEndian, EBO_BigEndian
END ENUM

since values are assigned starting with 0 by default.
0 Kudos
Reply