Maybe I missed something in the noise here, but I’m having trouble seeing the issue.
The desire to make CMPLX generic is moot. CMPLX is already generic. It will accept arguments that are complex, real, integer, or even boz constants.
The KEY point is that CMPLX is a type conversion function. Just like REAL. If I code REAL(x) I expect the result to be default REAL with the value of x, as close as conversion allows. In other words, convert X to type default REAL. If I code REAL(x, 8) then I expect the result to be REAL with KIND=8. Same pattern for INT. And for CMPLX.
The argument for a compiler option to change the interpretation of CMPX to something else that is incompatible with the standard seems equivalent to “I didn’t pay attention in my programming class, or had a bad teacher/textbook, and I don’t want to learn real Fortran but rather what to keep making my old mistakes over and over again”. It seems a request like that would get little interest from a compiler vendor.
But the discussion does raise the point that better teaching of Fortran programming and maybe more/better textbooks might be a good idea.
Cheers,
Bill
> On Jun 2, 2017, at 3:43 AM, Robin Vowels <[log in to unmask]> wrote:
>
> From: "Malcolm Cohen" <[log in to unmask]>
> Sent: Friday, June 02, 2017 6:30 PM
>
>
>> >The proposal does not invalidate any old programs.
>> Unfortunately it does, it invalidates programs going all the way back to
>> Fortran 77.
>
> You didn't read my proposal.
>
> I wrote :--
> Compatabilty with the old non-generic form, dating from the 1960s,
> can be provided by a compiler option.
>
>>> And some users could well find that their programs begin giving
>> more-accurate results !! because they did not use CMPLX correctly (and
>> inadvertently had their double-precision values quietly converted to single
>> precision).
>> And other users could well find their programs failing to compile, giving
>> incorrect results,
>
> Not with a compiler option.
>
>> or crashing at runtime because they are now passing
>> things twice as big as before, but the receiver is not expecting that.
>
> Not with a compiler option.
>
>>> The inadequacy of the existing CMPLX has caught professionals.
>
> And that's precisely the reason for making the change.
>
>> Which is precisely why I wrote:
>>>> You might find it easier to use a compiler that warns you when you've apparently forgotten to use the KIND argument of CMPLX.
>
> You also ignored the point that some users may find that their programs
> deliver more accurate results.
>
>> Such compilers are in fact available.
>
> That's useful, but irrelevant.
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
Bill Long [log in to unmask]
Principal Engineer, Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9143
Cray Inc./ 2131 Lindau Lane/ Suite 1000/ Bloomington, MN 55425
|