From: Gerhard Postpischil <gerh...@valley.net>
Date: Sunday, 12 February 2012 13:45

>On 2/12/2012 5:44 PM, robin wrote:
>> In this case, BCTR is inappropriate, because the length can be zero,
>> and use of SH provides the means to test for negative and to skip
>> the MVC (or CLC).
>
>You're drawing an unwarranted conclusion. It is quite possible
>that the length was tested earlier on in the code, and the
>author knows better than you that the BCTR is safe.

The programming world is littered with "it can't happen" cases.
Everyone knows Murphy's Law ("If anything can go wrong, it will").
But not many have heard of Robert's Law? ("Even if it can't go wrong, it will".)

So, even it the length were tested prior, one can't assume that all
will be well when the EX is reached.
The MVC can be destructive, and the only case where it isn't is when
the destination is of length 256.

The intended use of BCTR suggests to me that the author has not allowed for the
length being zero.

What it also suggests to me that the code is not bulletproof.

Setting up for a variable-length move (or compare) using EX
involves decrementing a length.  That is part and parcel of the move
(compare), and is best kept as a unit in order to avoid bugs.

For such a routine operation as a variable move, a macro
would offer many advantages.



--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply via email to