Hi Alistair,
This has been requested more than once. The operator "/=" already has a
different meaning, but it is probably possible to work around that.
People seem to mostly want += and *= anyway. The past arguments
against the idea have been more stylistic than technical, and evolving
programming habits (particularly multi-part derived type references)
might tip the balance the next time around.
Cheers,
Bill
On 1/6/11 4:05 AM, Alistair Hart wrote:
> Hi,
>
> Is there a reason why C-style composite assignment operators (+= etc.) are not supported in Fortran?
>
> I've certainly spent a lot of time over the years looking for bugs in lines like:
>
> res_tmp(1:npoints,2,3) = res_tmp(1:npoints,2,3) +&
> data_y_qqg_alg_basic(1:npoints) * tmp(1:npoints)
>
> where different slices of res_tmp were (mistakenly) specified on each side of the assignment. Using "+=" would also make the code more compact.
>
> Apologies if the answer is an old story - Googling for symbols is non-trivial.
>
> Thanks in anticipation,
>
> Alistair Hart.
--
Bill Long [log in to unmask]
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
|