+AD4- Admittedly, this might break some programs.
Yes we have come full circle. Breaking programs, especially by a silent change of semantics, is simply a bad idea.
It would be better to have an alternative constructor that can be used instead of CMPLX. It will require some careful work to achieve, but should be possible at some point in the future.
Cheers,
--
..............Malcolm Cohen, NAG Oxford/Tokyo.
-----Original Message-----
From: Fortran 90 List +AFs-mailto:COMP-FORTRAN-90+AEA-JISCMAIL.AC.UK+AF0- On Behalf Of W. J. Metzger
Sent: Tuesday, June 6, 2017 4:42 PM
To: COMP-FORTRAN-90+AEA-JISCMAIL.AC.UK
Subject: Re: +AFs-COMP-FORTRAN-90+AF0- Features for the next Fortran Standard (following Fortran 2015)
However, REAL(c) with c complex returns the real value of c with the kind of c. Thus if c is double precision complex, real returns a double precision real. Thus it seems not unreasonable to expect CMPLX(x, y) to return a complex with the kind of x.
Admittedly, this might break some programs.
Cheers, Wes
On Fri, 2017-06-02 at 15:48 +-0000, Bill Long wrote:
+AD4- Maybe I missed something in the noise here, but I+IBk-m having trouble seeing the issue.
+AD4-
+AD4- 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.
+AD4-
+AD4- 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+AD0-8. Same pattern for INT. And for CMPLX.
+AD4-
+AD4- The argument for a compiler option to change the interpretation of CMPX to something else that is incompatible with the standard seems equivalent to +IBw-I didn+IBk-t pay attention in my programming class, or had a bad teacher/textbook, and I don+IBk-t want to learn real Fortran but rather what to keep making my old mistakes over and over again+IB0-. It seems a request like that would get little interest from a compiler vendor.
+AD4-
+AD4- But the discussion does raise the point that better teaching of Fortran programming and maybe more/better textbooks might be a good idea.
+AD4-
+AD4- Cheers,
+AD4- Bill
+AD4-
+AD4-
+AD4-
+AD4- +AD4- On Jun 2, 2017, at 3:43 AM, Robin Vowels +ADw-robin51+AEA-DODO.COM.AU+AD4- wrote:
+AD4- +AD4-
+AD4- +AD4- From: +ACI-Malcolm Cohen+ACI- +ADw-malcolm+AEA-NAG-J.CO.JP+AD4-
+AD4- +AD4- Sent: Friday, June 02, 2017 6:30 PM
+AD4- +AD4-
+AD4- +AD4-
+AD4- +AD4APg- +AD4-The proposal does not invalidate any old programs.
+AD4- +AD4APg- Unfortunately it does, it invalidates programs going all the way
+AD4- +AD4APg- back to Fortran 77.
+AD4- +AD4-
+AD4- +AD4- You didn't read my proposal.
+AD4- +AD4-
+AD4- +AD4- I wrote :--
+AD4- +AD4- Compatabilty with the old non-generic form, dating from the 1960s,
+AD4- +AD4- can be provided by a compiler option.
+AD4- +AD4-
+AD4- +AD4APgA+- And some users could well find that their programs begin giving
+AD4- +AD4APg- more-accurate results +ACEAIQ- because they did not use CMPLX correctly
+AD4- +AD4APg- (and inadvertently had their double-precision values quietly
+AD4- +AD4APg- converted to single precision).
+AD4- +AD4APg- And other users could well find their programs failing to compile,
+AD4- +AD4APg- giving incorrect results,
+AD4- +AD4-
+AD4- +AD4- Not with a compiler option.
+AD4- +AD4-
+AD4- +AD4APg- or crashing at runtime because they are now passing things twice as
+AD4- +AD4APg- big as before, but the receiver is not expecting that.
+AD4- +AD4-
+AD4- +AD4- Not with a compiler option.
+AD4- +AD4-
+AD4- +AD4APgA+- The inadequacy of the existing CMPLX has caught professionals.
+AD4- +AD4-
+AD4- +AD4- And that's precisely the reason for making the change.
+AD4- +AD4-
+AD4- +AD4APg- Which is precisely why I wrote:
+AD4- +AD4APgA+AD4- You might find it easier to use a compiler that warns you when you've apparently forgotten to use the KIND argument of CMPLX.
+AD4- +AD4-
+AD4- +AD4- You also ignored the point that some users may find that their
+AD4- +AD4- programs deliver more accurate results.
+AD4- +AD4-
+AD4- +AD4APg- Such compilers are in fact available.
+AD4- +AD4-
+AD4- +AD4- That's useful, but irrelevant.
+AD4- +AD4-
+AD4- +AD4- ---
+AD4- +AD4- This email has been checked for viruses by Avast antivirus software.
+AD4- +AD4- https://www.avast.com/antivirus
+AD4-
+AD4- Bill Long longb+AEA-cray.com
+AD4- Principal Engineer, Fortran Technical Support +ACY- voice: 651-605-9024
+AD4- Bioinformatics Software Development fax: 651-605-9143
+AD4- Cray Inc./ 2131 Lindau Lane/ Suite 1000/ Bloomington, MN 55425
+AD4-
+AD4-
|