- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page