(j3.2006) VOLATILE or ASYNCHRONOUS function results ??

Bill Long longb
Tue Jan 10 15:05:06 EST 2017


On Jan 10, 2017, at 1:10 PM, Van Snyder <Van.Snyder at jpl.nasa.gov> wrote:

> On Tue, 2017-01-10 at 14:16 +0000, Bill Long wrote:
>> So, the value returned by the function as the result is disconnected
>> from the value of the internal result variable?   Otherwise, I have to
>> assume that it is the programmer?s fault if he/she  externally changes
>> the value in the memory location used by the result variable between
>> the end of the function execution and the point where the result value
>> is consumed (Note 15.40 in 17-007). 
>> 
>> I?m happy to have the compiler just allow VOLATILE for the result
>> variable, and let the users shoot themselves in the foot if they are
>> so inclined.
> 
> I don't see how this is different from the end of a BLOCK construct in
> which a variable has the VOLATILE attribute, but it doesn't have it
> outside the block.
> 

The values of local variables in a BLOCK construct are not expected to survive the end of the block.  Function results have to survive the end of the function, since they are consumed by the expression where the function reference appears. 

Cheers,
Bill

> 
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3

Bill Long                                                                       longb at cray.com
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





More information about the J3 mailing list