[J3] [EXTERNAL] [BULK] Re: Consistency in conversion functions
Jeff Hammond
jehammond at nvidia.com
Tue Apr 4 17:31:28 UTC 2023
While accommodating GCC’s non-standard extensions is very low priority for me, I am perfectly happy to exclude complex numbers from this and just focus on INTEGER() and LOGICAL(). INT() for INTEGER is the one that trips me up every time I have to use it, because it’s consistent with REAL() and the conversion behavior of every other language I use.
> On 4. Apr 2023, at 20.14, Steven G. Kargl <kargl at uw.edu> wrote:
>
> On Tue, Apr 04, 2023 at 04:17:56PM +0000, Jeff Hammond via J3 wrote:
>> Consistency is exactly why I want this, and I’m glad that non-human code composition tools motivate it as well.
>>
>> I see this as essentially trivial to fix. We just say that INTEGER() does the same thing as INT(). Same for COMPLEX() and CMPLX(). Then we never have to look at them again.
>>
>
> COMPLEX() and CMPLX() are not the same thing with gfortran.
>
> % cat a.f90
> program foo
> print *, kind(cmplx(1.d0,1.d0))
> print *, kind(complex(1.d0,1.d0))
> end program foo
>
> % gfortran11 -o z a.f90 && ./z
> 4
> 8
>
> I have no standing with J3, but I certainly hope someone
> who does would object to the needless duplication of an
> intrinsic procedure that perpetuates the problem with
> the default kind for CMPLX() in the absence of the third
> actual argument KIND=.
>
> --
> Steve
More information about the J3
mailing list