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

how to set the kind type of ENUM

志强_赵_
Beginner
348 Views

Hello All

In intel compiler 2015, if I want to use the enum. I have to use it as follows

enum,bind(c)

enumerator :: BLUE

end enum

So, the BLUE was set integer 4 as in the C lang.

Can I change it to integer 8?

0 Kudos
1 Reply
Lorri_M_Intel
Employee
348 Views

There is no language in the Fortran standard to allow you to do that, nor do we automatically widen them with the /integer-size:64 switch.

As you probably saw, part of the definition of the Fortran ENUM is this:

For an enumeration, the kind is selected such that an integer type with that kind is interoperable (15.3.2) with the
corresponding C enumeration type.

 

If you need integer parameters that are bigger (or smaller) than 4-byte integers, then you will need to explicitly define each one.

                   --Lorri

0 Kudos
Reply