[J3] [EXTERNAL] Re: 21-120r2: Discussion on the feasibility of any future enhancement of Enumeration Type
Bill Long
longb at cray.com
Tue Mar 2 21:44:12 UTC 2021
> On Mar 2, 2021, at 3:40 PM, Reuben D. Budiardja via J3 <j3 at mailman.j3-fortran.org> wrote:
>
> On 03/02/2021 01:11 PM, Ondřej Čertík via J3 wrote:
>> Hi,
>> The paper https://j3-fortran.org/doc/year/21/21-110r1.txt is extending the enum type, here is an example syntax (from the paper):
>> Module enum_mod
>> Enum,Bind(C) :: myenum
>> Enumerator :: one=1, two, three
>> End Enum
>> Enum,Bind(C) :: flags
>> Enumerator :: f1 = 1, f2 = 2, f3 = 4
>> End Enum
>> Contains
>> Subroutine sub(a) Bind(C)
>> Type(myenum),Value :: a
>> Print *,a ! Acts as if it is Print *,Int(a).
>> End Subroutine
>> End Module
>> Why cannot we simply allow to drop the `bind(c)`, then we have an enumeration type that we can use?
>
> Because this does not satisfy the requirements for "true enumerations types". The purpose of this one is to be better interoperable with C enum.
Additionally, I don’t see why the BIND(C) is harmful. You can put BIND(C) on lots of things that never end up interacting with C. It just enforces certain storage requirements.
Cheers,
Bill
>
>
>> I do not think we should have two enumeration types in the language.
>
> The way I see it, there will only be one enumeration type in 202X. This is 21-120r2. 21.110 is / should be really part of the interoperability with C.
>
> Best,
> Reuben
>
>
Bill Long longb at hpe.com
Engineer/Master , Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9143
Hewlett Packard Enterprise/ 2131 Lindau Lane/ Suite 1000/ Bloomington, MN 55425
More information about the J3
mailing list