Re: The MOVE problem
- From: "Judson McClendon" <judmc@xxxxxxxxxxxxx>
- Date: Wed, 31 Oct 2007 06:14:58 -0500
Thanks Bill, I thought you would come back with a definitive response. :-)
MOVE A(B) TO B C(B).
I would never consider writing such code as in this example. Code should
be written to be as simple and easy to understand as possible, and this
example violates that principle. Using two statements would make the intent
obvious.
--
Judson McClendon judmc@xxxxxxxxxxxxx (remove zero)
Sun Valley Systems http://sunvaley.com
"For God so loved the world that He gave His only begotten Son, that
whoever believes in Him should not perish but have everlasting life."
"William M. Klein" <wmklein@xxxxxxxxxxxxxxxxx> wrote:
The standard requires subscripts of the sending item o be evaluated once at the beginning of execution of the statement and of the
receiving item immediately before it gets its data. Pages 478-479 of the '02 Standard has:
***
Item identification for identifier-2 is performed immediately before the data is moved to the respective data tem. If identifier-2
is a zero-length item, the MOVE statement leaves identifier-2 unchanged.
If identifier-1 is reference modified, subscripted, or is a function-identifier, the reference modifier, subscript, or
function-identifier is evaluated only once, immediately before data is moved to the first of the receiving operands.
...
The result of the statement
MOVE a (b) TO b, c (b)
is equivalent to:
MOVE a (b) TO temp
MOVE temp TO b
MOVE temp to c (b)
where 'temp' is an intermediate result item provided by the implementor
***
Now having said that, the concept of "item identification" was new in the '02 Standard (as I recall) and although this EXACT same
"smple" appears in the '85 Standard (with the "temp" data item), my memory is that many (most?) compilers use "temp" as the
subscript for the receiving item.
Page VI-103 of the '85 Standard had the rule
"Any length evaluation or subscripting associated with identifier-2 is evaluated immediately before the data is moved to the
respective data item."
and then has exaclty the example given above.
--
Bill Klein
wmklein <at> ix.netcom.com
.
- Follow-Ups:
- Re: The MOVE problem
- From: William M. Klein
- Re: The MOVE problem
- From: Doug Miller
- Re: The MOVE problem
- References:
- The MOVE problem
- From: Roger While
- Re: The MOVE problem
- From: William M. Klein
- The MOVE problem
- Prev by Date: Re: [OT] System Conversion - An Overview
- Next by Date: Re: System Conversion - An Overview
- Previous by thread: Re: The MOVE problem
- Next by thread: Re: The MOVE problem
- Index(es):
Relevant Pages
|