Print

Print


Quite simple – Fortran 2008 added IMPURE ELEMENTAL.  Those can have side effects, and are applied in array element order.  For a PURE ELEMENTAL, the semantics (no side effects) are such that the order of execution makes no difference to the result.

 

So there is no change to the semantics for PURE ELEMENTAL, the change is to support IMPURE ELEMENTAL.

 

Cheers,

--

..............Malcolm Cohen, NAG Oxford/Tokyo.

 

From: Fortran 90 List [mailto:[log in to unmask]] On Behalf Of Harvey Richardson
Sent: Wednesday, August 23, 2017 4:43 AM
To: [log in to unmask]
Subject: Re: [COMP-FORTRAN-90] elemental procedures - array element order?

 


> Why should array element order matter?

 

Assuming I picked the correct documents...

 

For Fortran 95 the corresponding text had:

 

"In the array-valued case, the values of the elements, if any, of the result are the same

as would have been obtained if the scalar-valued function had been applied separately, in any order, to

corresponding elements of each argument."

 

For Fortran 2003:

 

"In the array case, the values of the

elements, if any, of the result are the same as would have been obtained if the scalar function had been

applied separately, in any order, to corresponding elements of each array actual argument."

 

For Fortran 2008:

 

"In the array case, the values of the elements, if any, of the result are

 the same as would have been obtained if the scalar function had been applied separately, in array element order,

to corresponding elements of each array actual argument."

 

Perhaps someone was thinking of extending elemental to arrays of same size but different rank using

array element order to define correspondence.  I can't imagine there were concerns about side effects

because this is a situation where you would not have any.

 

Harvey